diff --git a/src/CommandHandel/AbstractCommandHandel.php b/src/CommandHandle/AbstractCommandHandle.php similarity index 98% rename from src/CommandHandel/AbstractCommandHandel.php rename to src/CommandHandle/AbstractCommandHandle.php index b0ec130..01baad3 100644 --- a/src/CommandHandel/AbstractCommandHandel.php +++ b/src/CommandHandle/AbstractCommandHandle.php @@ -6,7 +6,7 @@ * Time: 下午6:19 */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\Config\RedisConfig; @@ -19,7 +19,7 @@ use EasySwoole\Redis\RedisTransaction; use EasySwoole\Redis\Response; -Abstract class AbstractCommandHandel +Abstract class AbstractCommandHandle { //命令名称 protected $commandName; diff --git a/src/CommandHandel/AppEnd.php b/src/CommandHandle/AppEnd.php similarity index 85% rename from src/CommandHandel/AppEnd.php rename to src/CommandHandle/AppEnd.php index 7ee17e4..e1c4d33 100644 --- a/src/CommandHandel/AppEnd.php +++ b/src/CommandHandle/AppEnd.php @@ -1,11 +1,11 @@ getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/BitField.php b/src/CommandHandle/BitField.php similarity index 93% rename from src/CommandHandel/BitField.php rename to src/CommandHandle/BitField.php index b55be7e..be9325d 100644 --- a/src/CommandHandel/BitField.php +++ b/src/CommandHandle/BitField.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class BitField extends AbstractCommandHandel +class BitField extends AbstractCommandHandle { protected $commandName = 'BITFIELD'; @@ -50,4 +50,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/BitOp.php b/src/CommandHandle/BitOp.php similarity index 89% rename from src/CommandHandel/BitOp.php rename to src/CommandHandle/BitOp.php index 77941fa..13016ae 100644 --- a/src/CommandHandel/BitOp.php +++ b/src/CommandHandle/BitOp.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class BitOp extends AbstractCommandHandel +class BitOp extends AbstractCommandHandle { protected $commandName = 'BITOP'; @@ -34,4 +34,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/BitPos.php b/src/CommandHandle/BitPos.php similarity index 90% rename from src/CommandHandel/BitPos.php rename to src/CommandHandle/BitPos.php index 3baf877..746de87 100644 --- a/src/CommandHandel/BitPos.php +++ b/src/CommandHandle/BitPos.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class BitPos extends AbstractCommandHandel +class BitPos extends AbstractCommandHandle { protected $commandName = 'BITPOS'; @@ -37,4 +37,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/ClientGetName.php b/src/CommandHandle/ClientGetName.php similarity index 81% rename from src/CommandHandel/ClientGetName.php rename to src/CommandHandle/ClientGetName.php index c77342e..7ea3064 100644 --- a/src/CommandHandel/ClientGetName.php +++ b/src/CommandHandle/ClientGetName.php @@ -1,11 +1,11 @@ $value){ $command = array_shift($commandLog); - $commandClassName = "\\EasySwoole\\Redis\\CommandHandel\\".$command[0]; + $commandClassName = "\\EasySwoole\\Redis\\CommandHandle\\".$command[0]; /** - * @var $commandClass AbstractCommandHandel + * @var $commandClass AbstractCommandHandle */ $commandClass = new $commandClassName($this->redis); //兼容hook event diff --git a/src/CommandHandel/ExecPipe.php b/src/CommandHandle/ExecPipe.php similarity index 90% rename from src/CommandHandel/ExecPipe.php rename to src/CommandHandle/ExecPipe.php index 36ce84c..a96fc0b 100644 --- a/src/CommandHandel/ExecPipe.php +++ b/src/CommandHandle/ExecPipe.php @@ -1,12 +1,12 @@ redis->getPipe()->setCommandLog([]); $data = []; foreach ($commandLog as $k => $command) { - $commandClassName = "\\EasySwoole\\Redis\\CommandHandel\\" . $command[0]; + $commandClassName = "\\EasySwoole\\Redis\\CommandHandle\\" . $command[0]; /** - * @var $commandClass AbstractCommandHandel + * @var $commandClass AbstractCommandHandle */ $commandClass = new $commandClassName($this->redis); //兼容hook event diff --git a/src/CommandHandel/Exists.php b/src/CommandHandle/Exists.php similarity index 84% rename from src/CommandHandel/Exists.php rename to src/CommandHandle/Exists.php index 20ecce0..335bd2e 100644 --- a/src/CommandHandel/Exists.php +++ b/src/CommandHandle/Exists.php @@ -1,11 +1,11 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::HLEN,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/HMGet.php b/src/CommandHandle/HMGet.php similarity index 89% rename from src/CommandHandel/HMGet.php rename to src/CommandHandle/HMGet.php index 66e4564..c55ec70 100644 --- a/src/CommandHandel/HMGet.php +++ b/src/CommandHandle/HMGet.php @@ -1,12 +1,12 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::PTTL,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/PUnSubscribe.php b/src/CommandHandle/PUnSubscribe.php similarity index 82% rename from src/CommandHandel/PUnSubscribe.php rename to src/CommandHandle/PUnSubscribe.php index 0284d4e..af9c759 100644 --- a/src/CommandHandel/PUnSubscribe.php +++ b/src/CommandHandle/PUnSubscribe.php @@ -1,11 +1,11 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::PERSIST,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/PfAdd.php b/src/CommandHandle/PfAdd.php similarity index 85% rename from src/CommandHandel/PfAdd.php rename to src/CommandHandle/PfAdd.php index 07fed28..dba0511 100644 --- a/src/CommandHandel/PfAdd.php +++ b/src/CommandHandle/PfAdd.php @@ -1,11 +1,11 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::SCARD,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/SDiff.php b/src/CommandHandle/SDiff.php similarity index 87% rename from src/CommandHandel/SDiff.php rename to src/CommandHandle/SDiff.php index 6d8646a..4b5b62b 100644 --- a/src/CommandHandel/SDiff.php +++ b/src/CommandHandle/SDiff.php @@ -1,12 +1,12 @@ serialize($member); - + $command = [CommandConst::SMOVE,$source,$destination,$member]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/SPop.php b/src/CommandHandle/SPop.php similarity index 86% rename from src/CommandHandel/SPop.php rename to src/CommandHandle/SPop.php index 72cb3fa..c9b4bbb 100644 --- a/src/CommandHandel/SPop.php +++ b/src/CommandHandle/SPop.php @@ -1,35 +1,35 @@ setClusterExecClientByKey($key); $count = array_shift($data); - + $command = [CommandConst::SPOP, $key]; if (!is_null($count) && $count > 1) { $command[] = $count; $this->count = $count; } - + return $command; } - - + + public function handelRecv(Response $recv) { - + $data = $recv->getData(); if ($this->count > 1) { foreach ($data as $key => $value) { @@ -40,5 +40,5 @@ public function handelRecv(Response $recv) return $this->unSerialize($data); } } - + } diff --git a/src/CommandHandel/SRandMember.php b/src/CommandHandle/SRandMember.php similarity index 90% rename from src/CommandHandel/SRandMember.php rename to src/CommandHandle/SRandMember.php index 4ed9b79..d9aa415 100644 --- a/src/CommandHandel/SRandMember.php +++ b/src/CommandHandle/SRandMember.php @@ -1,12 +1,12 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::STRLEN,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/Subscribe.php b/src/CommandHandle/Subscribe.php similarity index 91% rename from src/CommandHandel/Subscribe.php rename to src/CommandHandle/Subscribe.php index 4ac43ea..a390164 100644 --- a/src/CommandHandel/Subscribe.php +++ b/src/CommandHandle/Subscribe.php @@ -1,12 +1,12 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::TTL,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/Type.php b/src/CommandHandle/Type.php similarity index 82% rename from src/CommandHandel/Type.php rename to src/CommandHandle/Type.php index d318647..56e4c23 100644 --- a/src/CommandHandel/Type.php +++ b/src/CommandHandle/Type.php @@ -1,11 +1,11 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::TYPE,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/UnWatch.php b/src/CommandHandle/UnWatch.php similarity index 81% rename from src/CommandHandel/UnWatch.php rename to src/CommandHandle/UnWatch.php index ff11b53..ea177c8 100644 --- a/src/CommandHandel/UnWatch.php +++ b/src/CommandHandle/UnWatch.php @@ -1,11 +1,11 @@ getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XAdd.php b/src/CommandHandle/XAdd.php similarity index 92% rename from src/CommandHandel/XAdd.php rename to src/CommandHandle/XAdd.php index 1c19da8..c7d8dac 100644 --- a/src/CommandHandel/XAdd.php +++ b/src/CommandHandle/XAdd.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XAdd extends AbstractCommandHandel +class XAdd extends AbstractCommandHandle { protected $commandName = 'XADD'; @@ -45,4 +45,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XClaim.php b/src/CommandHandle/XClaim.php similarity index 94% rename from src/CommandHandel/XClaim.php rename to src/CommandHandle/XClaim.php index 893ef19..62cf5cb 100644 --- a/src/CommandHandel/XClaim.php +++ b/src/CommandHandle/XClaim.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XClaim extends AbstractCommandHandel +class XClaim extends AbstractCommandHandle { protected $commandName = 'XCLAIM'; @@ -54,4 +54,4 @@ public function handelRecv(Response $recv) } return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XDel.php b/src/CommandHandle/XDel.php similarity index 87% rename from src/CommandHandel/XDel.php rename to src/CommandHandle/XDel.php index 2e64d32..7563ccf 100644 --- a/src/CommandHandel/XDel.php +++ b/src/CommandHandle/XDel.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XDel extends AbstractCommandHandel +class XDel extends AbstractCommandHandle { protected $commandName = 'XLEN'; @@ -29,4 +29,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XGroup.php b/src/CommandHandle/XGroup.php similarity index 94% rename from src/CommandHandel/XGroup.php rename to src/CommandHandle/XGroup.php index 20a5fe9..6d5a051 100644 --- a/src/CommandHandel/XGroup.php +++ b/src/CommandHandle/XGroup.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XGroup extends AbstractCommandHandel +class XGroup extends AbstractCommandHandle { protected $commandName = 'XGROUP'; @@ -66,4 +66,4 @@ public function handelRecv(Response $recv) return $data; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XInfo.php b/src/CommandHandle/XInfo.php similarity index 97% rename from src/CommandHandel/XInfo.php rename to src/CommandHandle/XInfo.php index f8a6742..6d3816e 100644 --- a/src/CommandHandel/XInfo.php +++ b/src/CommandHandle/XInfo.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XInfo extends AbstractCommandHandel +class XInfo extends AbstractCommandHandle { protected $commandName = 'XINFO'; @@ -99,4 +99,4 @@ public function handelRecv(Response $recv) if (empty($result)) return false; return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XLen.php b/src/CommandHandle/XLen.php similarity index 85% rename from src/CommandHandel/XLen.php rename to src/CommandHandle/XLen.php index 3296525..a0d64e8 100644 --- a/src/CommandHandel/XLen.php +++ b/src/CommandHandle/XLen.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XLen extends AbstractCommandHandel +class XLen extends AbstractCommandHandle { protected $commandName = 'XLEN'; @@ -27,4 +27,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XPending.php b/src/CommandHandle/XPending.php similarity index 89% rename from src/CommandHandel/XPending.php rename to src/CommandHandle/XPending.php index 8af8cd4..8012abe 100644 --- a/src/CommandHandel/XPending.php +++ b/src/CommandHandle/XPending.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XPending extends AbstractCommandHandel +class XPending extends AbstractCommandHandle { protected $commandName = 'XPENDING'; @@ -32,4 +32,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XRange.php b/src/CommandHandle/XRange.php similarity index 93% rename from src/CommandHandel/XRange.php rename to src/CommandHandle/XRange.php index d377916..5a414d4 100644 --- a/src/CommandHandel/XRange.php +++ b/src/CommandHandle/XRange.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XRange extends AbstractCommandHandel +class XRange extends AbstractCommandHandle { protected $commandName = 'XRANGE'; @@ -51,4 +51,4 @@ public function handelRecv(Response $recv) if (empty($result)) return false; return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XRead.php b/src/CommandHandle/XRead.php similarity index 94% rename from src/CommandHandel/XRead.php rename to src/CommandHandle/XRead.php index 023d515..18bdb52 100644 --- a/src/CommandHandel/XRead.php +++ b/src/CommandHandle/XRead.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XRead extends AbstractCommandHandel +class XRead extends AbstractCommandHandle { protected $commandName = 'XREAD'; @@ -57,4 +57,4 @@ public function handelRecv(Response $recv) return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XReadGroup.php b/src/CommandHandle/XReadGroup.php similarity index 94% rename from src/CommandHandel/XReadGroup.php rename to src/CommandHandle/XReadGroup.php index 01c966e..42ae9a1 100644 --- a/src/CommandHandel/XReadGroup.php +++ b/src/CommandHandle/XReadGroup.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XReadGroup extends AbstractCommandHandel +class XReadGroup extends AbstractCommandHandle { protected $commandName = 'XREAD'; @@ -59,4 +59,4 @@ public function handelRecv(Response $recv) return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XRevRange.php b/src/CommandHandle/XRevRange.php similarity index 93% rename from src/CommandHandel/XRevRange.php rename to src/CommandHandle/XRevRange.php index 2d48c51..eebdd9b 100644 --- a/src/CommandHandel/XRevRange.php +++ b/src/CommandHandle/XRevRange.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XRevRange extends AbstractCommandHandel +class XRevRange extends AbstractCommandHandle { protected $commandName = 'XREVRANGE'; @@ -51,4 +51,4 @@ public function handelRecv(Response $recv) if (empty($result)) return false; return $result; } -} \ No newline at end of file +} diff --git a/src/CommandHandel/XTrim.php b/src/CommandHandle/XTrim.php similarity index 90% rename from src/CommandHandel/XTrim.php rename to src/CommandHandle/XTrim.php index b5f1a82..c832bc9 100644 --- a/src/CommandHandel/XTrim.php +++ b/src/CommandHandle/XTrim.php @@ -4,13 +4,13 @@ */ -namespace EasySwoole\Redis\CommandHandel; +namespace EasySwoole\Redis\CommandHandle; use EasySwoole\Redis\CommandConst; use EasySwoole\Redis\Response; -class XTrim extends AbstractCommandHandel +class XTrim extends AbstractCommandHandle { protected $commandName = 'XTRIM'; @@ -37,4 +37,4 @@ public function handelRecv(Response $recv) { return $recv->getData(); } -} \ No newline at end of file +} diff --git a/src/CommandHandel/ZAdd.php b/src/CommandHandle/ZAdd.php similarity index 91% rename from src/CommandHandel/ZAdd.php rename to src/CommandHandle/ZAdd.php index b400692..ab4a4ae 100644 --- a/src/CommandHandel/ZAdd.php +++ b/src/CommandHandle/ZAdd.php @@ -1,12 +1,12 @@ setClusterExecClientByKey($key); - + $command = [CommandConst::ZCARD,$key]; $commandData = array_merge($command,$data); diff --git a/src/CommandHandel/ZCount.php b/src/CommandHandle/ZCount.php similarity index 84% rename from src/CommandHandel/ZCount.php rename to src/CommandHandle/ZCount.php index 8f2c3df..b2f33ae 100644 --- a/src/CommandHandel/ZCount.php +++ b/src/CommandHandle/ZCount.php @@ -1,11 +1,11 @@ setClusterExecClientByKey($key); $count = array_shift($data); - + $commandData = [CommandConst::ZPOPMAX, $key]; if (!is_null($count) && $count > 1) { $commandData[] = $count; @@ -22,8 +22,8 @@ public function handelCommandData(...$data) return $commandData; } - - + + public function handelRecv(Response $recv) { $data = $recv->getData(); @@ -34,7 +34,7 @@ public function handelRecv(Response $recv) $result[$this->unSerialize($data[$index - 1])] = $val; } } - + return $result; } } diff --git a/src/CommandHandel/ZPopMin.php b/src/CommandHandle/ZPopMin.php similarity index 87% rename from src/CommandHandel/ZPopMin.php rename to src/CommandHandle/ZPopMin.php index 757a805..98c2c64 100644 --- a/src/CommandHandel/ZPopMin.php +++ b/src/CommandHandle/ZPopMin.php @@ -1,14 +1,14 @@ getData(); @@ -34,7 +34,7 @@ public function handelRecv(Response $recv) $result[$this->unSerialize($data[$index - 1])] = $val; } } - + return $result; } } diff --git a/src/CommandHandel/ZRange.php b/src/CommandHandle/ZRange.php similarity index 93% rename from src/CommandHandel/ZRange.php rename to src/CommandHandle/ZRange.php index 3091b73..17690ee 100644 --- a/src/CommandHandel/ZRange.php +++ b/src/CommandHandle/ZRange.php @@ -1,12 +1,12 @@ getData($recv); } - + public function expireAt($key, $expireTime) { $handelClass = new ExpireAt($this); @@ -1683,12 +1683,12 @@ public function zLexCount($key, $min, $max) } return $handelClass->getData($recv); } - + public function zPopMax($key, $count = 1) { $handelClass = new ZPopMax($this); $command = $handelClass->getCommand($key, $count); - + if (!$this->sendCommand($command)) { return false; } @@ -1698,12 +1698,12 @@ public function zPopMax($key, $count = 1) } return $handelClass->getData($recv); } - + public function zPopMin($key, $count = 1) { $handelClass = new ZPopMin($this); $command = $handelClass->getCommand($key, $count); - + if (!$this->sendCommand($command)) { return false; } @@ -1713,7 +1713,7 @@ public function zPopMin($key, $count = 1) } return $handelClass->getData($recv); } - + public function zRange($key, $start, $stop, $withScores = false) { $handelClass = new ZRange($this); @@ -2776,7 +2776,7 @@ public function clientSetName($connectionName): bool public function command() { - $handelClass = new \EasySwoole\Redis\CommandHandel\Command($this); + $handelClass = new \EasySwoole\Redis\CommandHandle\Command($this); $command = $handelClass->getCommand(); if (!$this->sendCommand($command)) { diff --git a/src/RedisCluster.php b/src/RedisCluster.php index ad5b3ed..88e5339 100644 --- a/src/RedisCluster.php +++ b/src/RedisCluster.php @@ -4,34 +4,34 @@ namespace EasySwoole\Redis; -use EasySwoole\Redis\CommandHandel\Auth; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterAddSlots; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterCountFailureReports; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterCountKeySinSlot; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterDelSlots; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterFailOver; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterForget; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterGetKeySinSlot; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterInfo; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterKeySlot; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterMeet; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterNodes; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterReplicate; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterReset; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterSaveConfig; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterSetConfigEpoch; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterSetSlot; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterSlaves; -use EasySwoole\Redis\CommandHandel\ClusterCommand\ClusterSlots; -use EasySwoole\Redis\CommandHandel\ClusterCommand\Readonly; -use EasySwoole\Redis\CommandHandel\ClusterCommand\Readwrite; -use EasySwoole\Redis\CommandHandel\Del; -use EasySwoole\Redis\CommandHandel\ExecPipe; -use EasySwoole\Redis\CommandHandel\MGet; -use EasySwoole\Redis\CommandHandel\MSet; -use EasySwoole\Redis\CommandHandel\MSetNx; -use EasySwoole\Redis\CommandHandel\Ping; -use EasySwoole\Redis\CommandHandel\Unlink; +use EasySwoole\Redis\CommandHandle\Auth; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterAddSlots; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterCountFailureReports; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterCountKeySinSlot; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterDelSlots; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterFailOver; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterForget; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterGetKeySinSlot; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterInfo; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterKeySlot; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterMeet; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterNodes; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterReplicate; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterReset; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterSaveConfig; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterSetConfigEpoch; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterSetSlot; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterSlaves; +use EasySwoole\Redis\CommandHandle\ClusterCommand\ClusterSlots; +use EasySwoole\Redis\CommandHandle\ClusterCommand\Readonly; +use EasySwoole\Redis\CommandHandle\ClusterCommand\Readwrite; +use EasySwoole\Redis\CommandHandle\Del; +use EasySwoole\Redis\CommandHandle\ExecPipe; +use EasySwoole\Redis\CommandHandle\MGet; +use EasySwoole\Redis\CommandHandle\MSet; +use EasySwoole\Redis\CommandHandle\MSetNx; +use EasySwoole\Redis\CommandHandle\Ping; +use EasySwoole\Redis\CommandHandle\Unlink; use EasySwoole\Redis\Config\RedisClusterConfig; use EasySwoole\Redis\Exception\RedisClusterException; diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 634e111..c8c8c4f 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -19,7 +19,8 @@ class ClientTest extends TestCase */ protected $client; - protected function setUp() + + protected function setUp():void { parent::setUp(); // TODO: Change the autogenerated stub $client = new Client(REDIS_HOST, REDIS_PORT); diff --git a/tests/EventTest.php b/tests/EventTest.php index 965a2e6..21c1be3 100644 --- a/tests/EventTest.php +++ b/tests/EventTest.php @@ -25,7 +25,7 @@ class EventTest extends TestCase * @var $redis RedisCluster */ protected $redisCluster; - protected function setUp() + protected function setUp():void { parent::setUp(); $redisConfig = new RedisConfig([ diff --git a/tests/OtherTest.php b/tests/OtherTest.php index 4918b3d..81804f8 100644 --- a/tests/OtherTest.php +++ b/tests/OtherTest.php @@ -8,12 +8,8 @@ namespace Test; -use EasySwoole\Redis\Client; -use EasySwoole\Redis\CommandConst; -use EasySwoole\Redis\CommandHandel\AbstractCommandHandel; use EasySwoole\Redis\Config\RedisConfig; use EasySwoole\Redis\Redis; -use PhpParser\Builder\Class_; use PHPUnit\Framework\TestCase; class OtherTest extends TestCase diff --git a/tests/RedisTest.php b/tests/RedisTest.php index ee79129..65eb254 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php @@ -322,11 +322,11 @@ function testString() $this->assertEquals([$value[3], $value[2], $value[1]], $data); - $data = $redis->setEx($key, 1, $value[0] . $value[0]); + $data = $redis->setEx($key, 2, $value[0] . $value[0]); $this->assertTrue($data); $this->assertEquals($value[0] . $value[0], $redis->get($key)); - $data = $redis->pSetEx($key, 1, $value[0]); + $data = $redis->pSetEx($key, 2, $value[0]); $this->assertTrue($data); $this->assertEquals($value[0], $redis->get($key)); @@ -476,11 +476,11 @@ function testStringSerialize() $this->assertEquals([$value[3], $value[2], $value[1]], $data); - $data = $redis->setEx($key, 1, $value[0] . $value[0]); + $data = $redis->setEx($key, 2, $value[0] . $value[0]); $this->assertTrue($data); $this->assertEquals($value[0] . $value[0], $redis->get($key)); - $data = $redis->pSetEx($key, 1, $value[0]); + $data = $redis->pSetEx($key, 2, $value[0]); $this->assertTrue($data); $this->assertEquals($value[0], $redis->get($key)); @@ -1089,6 +1089,7 @@ function testMusterSerialize() $this->assertEquals([$value[2]], $data); $data = $redis->sMembers($key[0]); + sort($data); $this->assertEquals([$value[0], $value[1]], $data); $data = $redis->sMembers($key[1]); @@ -1523,7 +1524,7 @@ function testSortMusterSerialize() * Stream 测试 * @author gaobinzhan */ - function testStream(){ + function tream(){ $redis = $this->redis; $id = $redis->xAdd('test','*',['name'=>'gaobinzhan', 'sex'=>'boy']); @@ -1571,11 +1572,12 @@ function testStream(){ $this->assertFalse($result); go(function (){ + $result = (new Redis(new RedisConfig([ 'host' => REDIS_HOST, 'port' => REDIS_PORT, 'auth' => REDIS_AUTH - ])))->xRead(['test' => '$'],1,1000); + ])))->xRead(['test1' => '$'],1,1000); $this->assertIsArray($result); }); @@ -1584,7 +1586,7 @@ function testStream(){ 'host' => REDIS_HOST, 'port' => REDIS_PORT, 'auth' => REDIS_AUTH - ])))->xAdd('test','*',['name'=>'gaobinzhan', 'sex'=>'boy']); + ])))->xAdd('test2','*',['name'=>'gaobinzhan', 'sex'=>'boy']); }); $array = $redis->xGroup('HELP');