diff --git a/src/Config.php b/src/Config.php index 0a467da..76b9372 100644 --- a/src/Config.php +++ b/src/Config.php @@ -12,6 +12,7 @@ class Config extends SplBean protected $port; protected $auth; protected $options = []; + protected $serialize=false; protected $timeout = 3; /** @@ -93,4 +94,21 @@ public function setTimeout(int $timeout): void { $this->timeout = $timeout; } + + /** + * @return bool + */ + public function getSerialize(): bool + { + return $this->serialize; + } + + /** + * @param bool $serialize + */ + public function setSerialize(bool $serialize): void + { + $this->serialize = $serialize; + } + } \ No newline at end of file diff --git a/src/Connection.php b/src/Connection.php index ec2ed8a..78f4f2f 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -6,7 +6,7 @@ use EasySwoole\Component\Pool\PoolObjectInterface; -class Connection extends \Redis implements PoolObjectInterface +class Connection extends \Swoole\Coroutine\Redis implements PoolObjectInterface { function gc() { diff --git a/src/Redis.php b/src/Redis.php index fd112b6..2dac576 100644 --- a/src/Redis.php +++ b/src/Redis.php @@ -39,7 +39,7 @@ protected function createObject() { $config = $this->getConfig()->getExtraConf(); $conn = new Connection(); - $ret = $conn->connect($config->getHost(),$config->getPort(),$config->getTimeout()); + $ret = $conn->connect($config->getHost(),$config->getPort(),$config->getSerialize()); if(!$ret){ return; }