modify
This commit is contained in:
+34
-33
@@ -17,42 +17,43 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @param bool $isMaster
|
* @param bool $isMaster
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getConnection(array $config, bool $isMaster): mixed
|
public function getConnection(array $config, bool $isMaster): mixed
|
||||||
{
|
{
|
||||||
return $this->get($config[0], $config);
|
$config[0] = md5($config[0]);
|
||||||
}
|
return $this->get($config[0], $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws NotFindClassException
|
* @throws NotFindClassException
|
||||||
*/
|
*/
|
||||||
public function createClient(string $name, array $config): mixed
|
public function createClient(string $name, array $config): mixed
|
||||||
{
|
{
|
||||||
// TODO: Implement createClient() method.
|
// TODO: Implement createClient() method.
|
||||||
return Snowflake::createObject(array_shift($config));
|
return Snowflake::createObject(array_shift($config));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param $object
|
* @param $object
|
||||||
*/
|
*/
|
||||||
public function release(string $name, mixed $object)
|
public function release(string $name, mixed $object)
|
||||||
{
|
{
|
||||||
if (method_exists($object, 'clean')) {
|
if (method_exists($object, 'clean')) {
|
||||||
$object->clean();
|
$object->clean();
|
||||||
}
|
}
|
||||||
$this->push($name, $object);
|
$this->push($name, $object);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user