qiushiyong пре 2 година
родитељ
комит
e6dfdcce86
100 измењених фајлова са 3718 додато и 7 уклоњено
  1. 5 3
      App/Com/Redis.php
  2. 2 1
      composer.json
  3. 60 1
      composer.lock
  4. 1 0
      vendor/composer/autoload_psr4.php
  5. 5 0
      vendor/composer/autoload_static.php
  6. 62 0
      vendor/composer/installed.json
  7. 11 2
      vendor/composer/installed.php
  8. 67 0
      vendor/easyswoole/redis/README.md
  9. 33 0
      vendor/easyswoole/redis/composer.json
  10. 12 0
      vendor/easyswoole/redis/phpunit.php
  11. 286 0
      vendor/easyswoole/redis/src/Client.php
  12. 63 0
      vendor/easyswoole/redis/src/ClusterClient.php
  13. 220 0
      vendor/easyswoole/redis/src/CommandConst.php
  14. 189 0
      vendor/easyswoole/redis/src/CommandHandle/AbstractCommandHandle.php
  15. 29 0
      vendor/easyswoole/redis/src/CommandHandle/AppEnd.php
  16. 27 0
      vendor/easyswoole/redis/src/CommandHandle/Auth.php
  17. 38 0
      vendor/easyswoole/redis/src/CommandHandle/BLPop.php
  18. 37 0
      vendor/easyswoole/redis/src/CommandHandle/BRPop.php
  19. 30 0
      vendor/easyswoole/redis/src/CommandHandle/BRPopLPush.php
  20. 33 0
      vendor/easyswoole/redis/src/CommandHandle/BZPopMax.php
  21. 33 0
      vendor/easyswoole/redis/src/CommandHandle/BZPopMin.php
  22. 25 0
      vendor/easyswoole/redis/src/CommandHandle/BgRewriteAof.php
  23. 25 0
      vendor/easyswoole/redis/src/CommandHandle/BgSave.php
  24. 40 0
      vendor/easyswoole/redis/src/CommandHandle/BitCount.php
  25. 53 0
      vendor/easyswoole/redis/src/CommandHandle/BitField.php
  26. 37 0
      vendor/easyswoole/redis/src/CommandHandle/BitOp.php
  27. 40 0
      vendor/easyswoole/redis/src/CommandHandle/BitPos.php
  28. 25 0
      vendor/easyswoole/redis/src/CommandHandle/ClientGetName.php
  29. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClientKill.php
  30. 40 0
      vendor/easyswoole/redis/src/CommandHandle/ClientList.php
  31. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClientPause.php
  32. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClientSetName.php
  33. 32 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterAddSlots.php
  34. 25 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterCountFailureReports.php
  35. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterCountKeySinSlot.php
  36. 32 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterDelSlots.php
  37. 30 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterFailOver.php
  38. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterForget.php
  39. 28 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterGetKeySinSlot.php
  40. 34 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterInfo.php
  41. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterKeySlot.php
  42. 28 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterMeet.php
  43. 55 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterNodes.php
  44. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterReplicate.php
  45. 30 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterReset.php
  46. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSaveConfig.php
  47. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSetConfigEpoch.php
  48. 32 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSetSlot.php
  49. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSlaves.php
  50. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSlots.php
  51. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/Readonly.php
  52. 26 0
      vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/Readwrite.php
  53. 25 0
      vendor/easyswoole/redis/src/CommandHandle/Command.php
  54. 27 0
      vendor/easyswoole/redis/src/CommandHandle/CommandCount.php
  55. 27 0
      vendor/easyswoole/redis/src/CommandHandle/CommandGetKeys.php
  56. 27 0
      vendor/easyswoole/redis/src/CommandHandle/CommandInfo.php
  57. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ConfigGet.php
  58. 27 0
      vendor/easyswoole/redis/src/CommandHandle/ConfigResetStat.php
  59. 25 0
      vendor/easyswoole/redis/src/CommandHandle/ConfigRewrite.php
  60. 28 0
      vendor/easyswoole/redis/src/CommandHandle/ConfigSet.php
  61. 28 0
      vendor/easyswoole/redis/src/CommandHandle/Construct.php
  62. 26 0
      vendor/easyswoole/redis/src/CommandHandle/DBSize.php
  63. 28 0
      vendor/easyswoole/redis/src/CommandHandle/DebugObject.php
  64. 26 0
      vendor/easyswoole/redis/src/CommandHandle/DebugSegfault.php
  65. 30 0
      vendor/easyswoole/redis/src/CommandHandle/Decr.php
  66. 31 0
      vendor/easyswoole/redis/src/CommandHandle/DecrBy.php
  67. 32 0
      vendor/easyswoole/redis/src/CommandHandle/Del.php
  68. 27 0
      vendor/easyswoole/redis/src/CommandHandle/Discard.php
  69. 27 0
      vendor/easyswoole/redis/src/CommandHandle/DiscardPipe.php
  70. 28 0
      vendor/easyswoole/redis/src/CommandHandle/Dump.php
  71. 48 0
      vendor/easyswoole/redis/src/CommandHandle/Exec.php
  72. 55 0
      vendor/easyswoole/redis/src/CommandHandle/ExecPipe.php
  73. 29 0
      vendor/easyswoole/redis/src/CommandHandle/Exists.php
  74. 29 0
      vendor/easyswoole/redis/src/CommandHandle/Expire.php
  75. 32 0
      vendor/easyswoole/redis/src/CommandHandle/ExpireAt.php
  76. 25 0
      vendor/easyswoole/redis/src/CommandHandle/FlushAll.php
  77. 26 0
      vendor/easyswoole/redis/src/CommandHandle/FlushDb.php
  78. 34 0
      vendor/easyswoole/redis/src/CommandHandle/GeoAdd.php
  79. 31 0
      vendor/easyswoole/redis/src/CommandHandle/GeoDist.php
  80. 29 0
      vendor/easyswoole/redis/src/CommandHandle/GeoHash.php
  81. 29 0
      vendor/easyswoole/redis/src/CommandHandle/GeoPos.php
  82. 67 0
      vendor/easyswoole/redis/src/CommandHandle/GeoRadius.php
  83. 64 0
      vendor/easyswoole/redis/src/CommandHandle/GeoRadiusByMember.php
  84. 25 0
      vendor/easyswoole/redis/src/CommandHandle/Get.php
  85. 32 0
      vendor/easyswoole/redis/src/CommandHandle/GetBit.php
  86. 31 0
      vendor/easyswoole/redis/src/CommandHandle/GetRange.php
  87. 33 0
      vendor/easyswoole/redis/src/CommandHandle/GetSet.php
  88. 29 0
      vendor/easyswoole/redis/src/CommandHandle/HDel.php
  89. 32 0
      vendor/easyswoole/redis/src/CommandHandle/HExists.php
  90. 31 0
      vendor/easyswoole/redis/src/CommandHandle/HGet.php
  91. 35 0
      vendor/easyswoole/redis/src/CommandHandle/HGetAll.php
  92. 33 0
      vendor/easyswoole/redis/src/CommandHandle/HIncrBy.php
  93. 33 0
      vendor/easyswoole/redis/src/CommandHandle/HIncrByFloat.php
  94. 29 0
      vendor/easyswoole/redis/src/CommandHandle/HKeys.php
  95. 31 0
      vendor/easyswoole/redis/src/CommandHandle/HLen.php
  96. 37 0
      vendor/easyswoole/redis/src/CommandHandle/HMGet.php
  97. 35 0
      vendor/easyswoole/redis/src/CommandHandle/HMSet.php
  98. 47 0
      vendor/easyswoole/redis/src/CommandHandle/HScan.php
  99. 33 0
      vendor/easyswoole/redis/src/CommandHandle/HSet.php
  100. 0 0
      vendor/easyswoole/redis/src/CommandHandle/HSetNx.php

+ 5 - 3
App/Com/Redis.php

@@ -2,6 +2,7 @@
 namespace App\Com;
 
 use EasySwoole\EasySwoole\Config;
+use EasySwoole\Redis\Config\RedisConfig;
 
 class Redis
 {
@@ -18,9 +19,10 @@ class Redis
     function __construct()
     {
     	$db_config = Config::getInstance()->getConf('REDIS');
-        $this->connect = new \Redis(); 
-        $this->connect->connect($db_config['host'], $db_config['port']); //连接Redis
-        $this->connect->auth($db_config['auth']); //密码验证
+        $config = new RedisConfig($db_config);
+        $this->connect = new \EasySwoole\Redis\Redis($config);
+//        $this->connect->connect($db_config['host'], $db_config['port']); //连接Redis
+//        $this->connect->auth($db_config['auth']); //密码验证
     }
 
     public function getConnect(){

+ 2 - 1
composer.json

@@ -5,7 +5,8 @@
         "flc/alidayu": "^2.0",
         "mrgoon/aliyun-sms": "^2.0",
         "phpmailer/phpmailer": "^6.6",
-        "easyswoole/swoole-ide-helper": "^1.3"
+        "easyswoole/swoole-ide-helper": "^1.3",
+        "easyswoole/redis": "^1.3"
     },
     "autoload": {
         "psr-4": {

+ 60 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "836be4ff53b415e4458c03c7a1a5ea4a",
+    "content-hash": "c94a4eb796829caccd1d05cef4b40b19",
     "packages": [
         {
             "name": "doctrine/instantiator",
@@ -1121,6 +1121,65 @@
             "time": "2022-01-24T04:40:26+00:00"
         },
         {
+            "name": "easyswoole/redis",
+            "version": "1.3.10",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/easy-swoole/redis.git",
+                "reference": "d970f5672353b6dc203950779d464d6dcfa54de8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/easy-swoole/redis/zipball/d970f5672353b6dc203950779d464d6dcfa54de8",
+                "reference": "d970f5672353b6dc203950779d464d6dcfa54de8",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "easyswoole/spl": "^1.2",
+                "ext-swoole": "^4.4.0",
+                "php": ">=7.1.0"
+            },
+            "require-dev": {
+                "easyswoole/phpunit": ">=1.0.0",
+                "easyswoole/swoole-ide-helper": "^1.2"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "EasySwoole\\Redis\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "YF",
+                    "email": "291323003@qq.com"
+                }
+            ],
+            "description": "easyswoole component",
+            "homepage": "https://www.easyswoole.com/",
+            "keywords": [
+                "async",
+                "easyswoole",
+                "framework",
+                "swoole"
+            ],
+            "support": {
+                "issues": "https://github.com/easy-swoole/redis/issues",
+                "source": "https://github.com/easy-swoole/redis/tree/1.3.10"
+            },
+            "time": "2021-05-07T02:18:36+00:00"
+        },
+        {
             "name": "easyswoole/session",
             "version": "3.0.1",
             "source": {

+ 1 - 0
vendor/composer/autoload_psr4.php

@@ -28,6 +28,7 @@ return array(
     'EasySwoole\\Socket\\' => array($vendorDir . '/easyswoole/socket/src'),
     'EasySwoole\\Session\\Test\\' => array($vendorDir . '/easyswoole/session/tests'),
     'EasySwoole\\Session\\' => array($vendorDir . '/easyswoole/session/src'),
+    'EasySwoole\\Redis\\' => array($vendorDir . '/easyswoole/redis/src'),
     'EasySwoole\\Pool\\Tests\\' => array($vendorDir . '/easyswoole/pool/tests'),
     'EasySwoole\\Pool\\' => array($vendorDir . '/easyswoole/pool/src'),
     'EasySwoole\\Phpunit\\' => array($vendorDir . '/easyswoole/phpunit/src'),

+ 5 - 0
vendor/composer/autoload_static.php

@@ -60,6 +60,7 @@ class ComposerStaticInit5c9edf2879fb862dd4488a33a978cd99
             'EasySwoole\\Socket\\' => 18,
             'EasySwoole\\Session\\Test\\' => 24,
             'EasySwoole\\Session\\' => 19,
+            'EasySwoole\\Redis\\' => 17,
             'EasySwoole\\Pool\\Tests\\' => 22,
             'EasySwoole\\Pool\\' => 16,
             'EasySwoole\\Phpunit\\' => 19,
@@ -192,6 +193,10 @@ class ComposerStaticInit5c9edf2879fb862dd4488a33a978cd99
         array (
             0 => __DIR__ . '/..' . '/easyswoole/session/src',
         ),
+        'EasySwoole\\Redis\\' => 
+        array (
+            0 => __DIR__ . '/..' . '/easyswoole/redis/src',
+        ),
         'EasySwoole\\Pool\\Tests\\' => 
         array (
             0 => __DIR__ . '/..' . '/easyswoole/pool/tests',

+ 62 - 0
vendor/composer/installed.json

@@ -1175,6 +1175,68 @@
             "install-path": "../easyswoole/pool"
         },
         {
+            "name": "easyswoole/redis",
+            "version": "1.3.10",
+            "version_normalized": "1.3.10.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/easy-swoole/redis.git",
+                "reference": "d970f5672353b6dc203950779d464d6dcfa54de8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/easy-swoole/redis/zipball/d970f5672353b6dc203950779d464d6dcfa54de8",
+                "reference": "d970f5672353b6dc203950779d464d6dcfa54de8",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "easyswoole/spl": "^1.2",
+                "ext-swoole": "^4.4.0",
+                "php": ">=7.1.0"
+            },
+            "require-dev": {
+                "easyswoole/phpunit": ">=1.0.0",
+                "easyswoole/swoole-ide-helper": "^1.2"
+            },
+            "time": "2021-05-07T02:18:36+00:00",
+            "type": "library",
+            "installation-source": "dist",
+            "autoload": {
+                "psr-4": {
+                    "EasySwoole\\Redis\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "Apache-2.0"
+            ],
+            "authors": [
+                {
+                    "name": "YF",
+                    "email": "291323003@qq.com"
+                }
+            ],
+            "description": "easyswoole component",
+            "homepage": "https://www.easyswoole.com/",
+            "keywords": [
+                "async",
+                "easyswoole",
+                "framework",
+                "swoole"
+            ],
+            "support": {
+                "issues": "https://github.com/easy-swoole/redis/issues",
+                "source": "https://github.com/easy-swoole/redis/tree/1.3.10"
+            },
+            "install-path": "../easyswoole/redis"
+        },
+        {
             "name": "easyswoole/session",
             "version": "3.0.1",
             "version_normalized": "3.0.1.0",

+ 11 - 2
vendor/composer/installed.php

@@ -5,7 +5,7 @@
         'type' => 'library',
         'install_path' => __DIR__ . '/../../',
         'aliases' => array(),
-        'reference' => 'a9e468cb180f031b594e342a03fce5912629ed6a',
+        'reference' => '079cef7ee5014a7d47831c2d3347890e6a7819c9',
         'name' => '__root__',
         'dev' => true,
     ),
@@ -16,7 +16,7 @@
             'type' => 'library',
             'install_path' => __DIR__ . '/../../',
             'aliases' => array(),
-            'reference' => 'a9e468cb180f031b594e342a03fce5912629ed6a',
+            'reference' => '079cef7ee5014a7d47831c2d3347890e6a7819c9',
             'dev_requirement' => false,
         ),
         'doctrine/instantiator' => array(
@@ -199,6 +199,15 @@
             'reference' => '25241d5107acd7f58ab5a37f04adecc65a84ec64',
             'dev_requirement' => false,
         ),
+        'easyswoole/redis' => array(
+            'pretty_version' => '1.3.10',
+            'version' => '1.3.10.0',
+            'type' => 'library',
+            'install_path' => __DIR__ . '/../easyswoole/redis',
+            'aliases' => array(),
+            'reference' => 'd970f5672353b6dc203950779d464d6dcfa54de8',
+            'dev_requirement' => false,
+        ),
         'easyswoole/session' => array(
             'pretty_version' => '3.0.1',
             'version' => '3.0.1.0',

+ 67 - 0
vendor/easyswoole/redis/README.md

@@ -0,0 +1,67 @@
+# Redis客户端
+
+## 单元测试
+测试前记得修改phpunit.php修改配置
+```
+./vendor/bin/co-phpunit tests
+```
+## redis详细文档
+http://www.easyswoole.com/Components/Redis/introduction.html
+
+## 支持方法
+目前,该redis客户端组件,已经支持除去脚本外的所有方法(目前支持了178个方法):
+
+- 连接方法(connection)
+- 集群方法(cluster)
+- geohash
+- 哈希(hash)
+- 键(keys)
+- 列表(lists)
+- 发布/订阅(pub/sub)
+- 服务器(server)
+- 字符串(string)
+- 有序集合(sorted sets)
+- 集合 (sets)
+- 流(stream)
+- 事务 (transaction)
+- 管道支持 (pipe)
+
+> 由于redis的命令较多,可能漏掉1,2个命令
+
+
+## redis使用示例
+```php
+<?php
+include "../vendor/autoload.php";
+go(function (){
+    $redis = new \EasySwoole\Redis\Redis(new \EasySwoole\Redis\Config\RedisConfig([
+        'host' => '127.0.0.1',
+        'port' => '6379',
+        'auth' => 'easyswoole',
+        'serialize' => \EasySwoole\Redis\Config\RedisConfig::SERIALIZE_NONE
+    ]));
+    var_dump($redis->set('a',1));
+    var_dump($redis->get('a'));
+});
+```
+
+## redis集群使用示例
+```php
+<?php
+include "../vendor/autoload.php";
+go(function () {
+    $redis = new \EasySwoole\Redis\RedisCluster(new \EasySwoole\Redis\Config\RedisClusterConfig([
+        ['172.16.253.156', 9001],
+        ['172.16.253.156', 9002],
+        ['172.16.253.156', 9003],
+        ['172.16.253.156', 9004],
+    ], [
+        'auth' => '',
+        'serialize' => \EasySwoole\Redis\Config\RedisConfig::SERIALIZE_PHP
+    ]));
+    var_dump($redis->set('a',1));
+    var_dump($redis->get('a'));
+    var_dump($redis->clusterKeySlot('a'));
+
+});
+```

+ 33 - 0
vendor/easyswoole/redis/composer.json

@@ -0,0 +1,33 @@
+{
+    "name": "easyswoole/redis",
+    "type": "library",
+    "description": "easyswoole component",
+    "keywords" : ["swoole", "framework", "async","easyswoole"],
+    "homepage" : "https://www.easyswoole.com/",
+    "license" : "Apache-2.0",
+    "authors": [
+        {
+            "name": "YF",
+            "email": "291323003@qq.com"
+        }
+    ],
+    "require": {
+        "php": ">=7.1.0",
+        "ext-swoole":"^4.4.0",
+        "easyswoole/spl": "^1.2"
+    },
+    "require-dev": {
+        "easyswoole/swoole-ide-helper": "^1.2",
+        "easyswoole/phpunit":">=1.0.0"
+    },
+    "autoload": {
+        "psr-4": {
+            "EasySwoole\\Redis\\": "src/"
+        }
+    },
+    "autoload-dev": {
+        "psr-4": {
+            "EasySwoole\\Redis\\Test\\":"test/"
+        }
+    }
+}

+ 12 - 0
vendor/easyswoole/redis/phpunit.php

@@ -0,0 +1,12 @@
+<?php
+
+defined("REDIS_HOST") ?: define('REDIS_HOST', '127.0.0.1');
+defined("REDIS_PORT") ?: define('REDIS_PORT', 6379);
+defined("REDIS_AUTH") ?: define('REDIS_AUTH', '');
+defined("REDIS_UNIX_SOCKET") ?: define('REDIS_UNIX_SOCKET', '/tmp/redis.sock');
+
+defined("REDIS_CLUSTER_SERVER_LIST") ?: define('REDIS_CLUSTER_SERVER_LIST',
+    [
+        ['127.0.0.1', 9001],
+    ]);
+defined("REDIS_CLUSTER_AUTH") ?: define('REDIS_CLUSTER_AUTH', '');

+ 286 - 0
vendor/easyswoole/redis/src/Client.php

@@ -0,0 +1,286 @@
+<?php
+
+
+namespace EasySwoole\Redis;
+
+
+class Client
+{
+    /**
+     * @var \Swoole\Coroutine\Client
+     */
+    protected $client;
+    protected $host;
+    protected $port;
+    protected $packageMaxLength;
+
+    function __construct(string $host, int $port,$packageMaxLength=1024*1024*2)
+    {
+        $this->host = $host;
+        $this->port = $port;
+        $this->packageMaxLength = $packageMaxLength;
+    }
+
+    public function connect(float $timeout = 3.0): bool
+    {
+        if ($this->client == null) {
+            $this->client = new \Swoole\Coroutine\Client(SWOOLE_TCP);
+            $this->client->set([
+                'open_eof_check'     => true,
+                'package_eof'        => "\r\n",
+                'package_max_length' =>  $this->packageMaxLength
+            ]);
+        }
+
+        return $this->client->connect($this->host, $this->port, $timeout);
+    }
+
+    public function send(string $data): bool
+    {
+        return strlen($data) === $this->client->send($data);
+    }
+
+    public function sendCommand(array $commandList): bool
+    {
+        $argNum = count($commandList);
+        $str = "*{$argNum}\r\n";
+        foreach ($commandList as $value) {
+            $len = strlen($value);
+            $str = $str . '$' . "{$len}\r\n{$value}\r\n";
+        }
+        return $this->send($str);
+    }
+
+    function recv(float $timeout = 3.0): ?Response
+    {
+        /*
+         *
+            用单行回复,回复的第一个字节将是“+”
+            错误消息,回复的第一个字节将是“-”
+            整型数字,回复的第一个字节将是“:”
+            批量回复,回复的第一个字节将是“$”
+            多个批量回复,回复的第一个字节将是“*”
+         */
+        $result = new Response();
+        $str = $this->client->recv($timeout);
+        if (empty($str)) {
+            $result->setStatus($result::STATUS_TIMEOUT);
+            $result->setMsg($this->client->errMsg);
+            return $result;
+        }
+        /**
+         * 去除每行的\r\n
+         */
+        $str = substr($str, 0, -2);
+        $op = substr($str, 0, 1);
+        $result = $this->opHandel($op, $str, $timeout);
+        return $result;
+    }
+
+    /**
+     * 字符串处理方法
+     * opHandel
+     * @param $op
+     * @param $value
+     * @param $timeout
+     * @return Response
+     * @author Tioncico
+     * Time: 11:52
+     */
+    protected function opHandel($op, $value, float $timeout)
+    {
+        $result = new Response();
+        switch ($op) {
+            case '+':
+                {
+                    $result = $this->successHandel($value);
+                    break;
+                }
+            case '-':
+                {
+                    $result = $this->errorHandel($value);
+                    break;
+                }
+            case ':':
+                {
+                    $result = $this->intHandel($value);
+                    break;
+                }
+            case '$':
+                {
+                    $result = $this->batchHandel($value, $timeout);
+                    break;
+                }
+            case "*":
+                {
+                    $result = $this->multipleBatchHandel($value, $timeout);
+                    break;
+                }
+        }
+        return $result;
+    }
+
+    /**
+     * 状态类型处理
+     * successHandel
+     * @param $value
+     * @return Response
+     * @author Tioncico
+     * Time: 11:52
+     */
+    protected function successHandel($value): Response
+    {
+        $result = new Response();
+        $result->setStatus($result::STATUS_OK);
+        $result->setData(substr($value, 1));
+        return $result;
+    }
+
+    /**
+     * 错误类型处理
+     * errorHandel
+     * @param $value
+     * @return Response
+     * @author Tioncico
+     * Time: 11:53
+     */
+    protected function errorHandel($value): Response
+    {
+        $result = new Response();
+        //查看空格位置
+        $spaceIndex = strpos($value, ' ');
+        //查看换行位置
+        $lineIndex = strpos($value, PHP_EOL);
+        if ($lineIndex === false || $lineIndex > $spaceIndex) {
+            $result->setErrorType(substr($value, 1, $spaceIndex - 1));
+        } else {
+            $result->setErrorType(substr($value, 1, $lineIndex - 1));
+        }
+        $result->setStatus($result::STATUS_ERR);
+        $result->setMsg(substr($value, 1));
+        return $result;
+    }
+
+    /**
+     * int类型处理
+     * intHandel
+     * @param $value
+     * @return Response
+     * @author Tioncico
+     * Time: 11:53
+     */
+    protected function intHandel($value): Response
+    {
+        $result = new Response();
+        $result->setStatus($result::STATUS_OK);
+        $result->setData((int)substr($value, 1));
+        return $result;
+    }
+
+    /**
+     * 批量回复处理
+     * batchHandel
+     * @param $str
+     * @param $timeout
+     * @return bool|string
+     * @author Tioncico
+     * Time: 17:13
+     */
+    protected function batchHandel($str, float $timeout)
+    {
+        $response = new Response();
+        $strLen = substr($str, 1);
+        //批量回复,继续读取字节
+        $len = 0;
+        $buff = '';
+        if ($strLen == 0) {
+            $this->client->recv($timeout);
+            $response->setData('');
+        } elseif ($strLen == -1) {
+            $response->setData(null);
+        } else {
+            $eolLen = strlen("\r\n");
+            while ($len < $strLen + $eolLen) {
+                $strTmp = $this->client->recv($timeout);
+                $len += strlen($strTmp);
+                //超时
+                if ($len < $strLen + $eolLen && empty($strTmp)) {
+                    $response->setStatus($response::STATUS_TIMEOUT);
+                    $response->setMsg($this->client->errMsg);
+                    return $response;
+                }
+                $buff .= $strTmp;
+            }
+            $response->setData(substr($buff, 0, -2));
+        }
+        $response->setStatus($response::STATUS_OK);
+        return $response;
+    }
+
+    /**
+     * 多条批量回复
+     * multipleBatchHandel
+     * @param $value
+     * @param $timeout
+     * @return Response
+     * @author Tioncico
+     * Time: 14:33
+     */
+    protected function multipleBatchHandel($value, float $timeout)
+    {
+        $result = new Response();
+        $len = substr($value, 1);
+        if ($len == 0) {
+            $result->setStatus($result::STATUS_OK);
+            $result->setData([]);
+        } elseif ($len == -1) {
+            $result->setStatus($result::STATUS_OK);
+            $result->setData(null);
+        } else {
+            $arr = [];
+            while ($len--) {
+                $str = $this->client->recv($timeout);
+                if (empty($str)) {
+                    $result->setStatus($result::STATUS_TIMEOUT);
+                    $result->setMsg($this->client->errMsg);
+                    return $result;
+                }
+                $str = substr($str, 0, -2);
+                $op = substr($str, 0, 1);
+                $response = $this->opHandel($op, $str, $timeout);
+                if ($response->getStatus() != $response::STATUS_OK) {
+                    $arr[] = false;
+                } else {
+                    $arr[] = $response->getData();
+                }
+            }
+            $result->setStatus($result::STATUS_OK);
+            $result->setData($arr);
+        }
+        return $result;
+    }
+
+    function close()
+    {
+        if ($this->client) {
+            $this->client->close();
+            $this->client = null;
+        }
+    }
+
+    public function socketError()
+    {
+        return $this->client->errMsg;
+    }
+
+    public function socketErrno()
+    {
+        return $this->client->errCode;
+    }
+
+    public function __destruct()
+    {
+        $this->close();;
+    }
+
+}

+ 63 - 0
vendor/easyswoole/redis/src/ClusterClient.php

@@ -0,0 +1,63 @@
+<?php
+
+
+namespace EasySwoole\Redis;
+
+
+class ClusterClient extends Client
+{
+    /**
+     * @var $isConnected bool
+     */
+    protected $isConnected=false;
+
+    /**
+     * @return bool
+     */
+    public function isConnected(): bool
+    {
+        return $this->isConnected;
+    }
+
+    /**
+     * @param bool $isConnected
+     */
+    public function setIsConnected(bool $isConnected): void
+    {
+        $this->isConnected = $isConnected;
+    }
+
+    /**
+     * @return string
+     */
+    public function getHost(): string
+    {
+        return $this->host;
+    }
+
+    /**
+     * @param string $host
+     */
+    public function setHost(string $host): void
+    {
+        $this->host = $host;
+    }
+
+    /**
+     * @return int
+     */
+    public function getPort(): int
+    {
+        return $this->port;
+    }
+
+    /**
+     * @param int $port
+     */
+    public function setPort(int $port): void
+    {
+        $this->port = $port;
+    }
+
+
+}

+ 220 - 0
vendor/easyswoole/redis/src/CommandConst.php

@@ -0,0 +1,220 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Tioncico
+ * Date: 2019/9/28 0028
+ * Time: 11:38
+ */
+
+namespace EasySwoole\Redis;
+
+
+class CommandConst
+{
+    const DEL = 'DEL';//该命令用于在 key 存在是删除 key。
+    const UNLINK = 'UNLINK';//非阻塞删除key。
+    const DUMP = 'DUMP';//序列化给定 key ,并返回被序列化的值。
+    const EXISTS = 'EXISTS';//检查给定 key 是否存在。
+    const EXPIRE = 'EXPIRE';//为给定 key 设置过期时间。
+    const EXPIREAT = 'EXPIREAT';//EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置过期时间。 不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
+    const PEXPIRE = 'PEXPIRE';//设置 key 的过期时间亿以毫秒计。
+    const PEXPIREAT = 'PEXPIREAT';//设置 key 过期时间的时间戳(unix timestamp) 以毫秒计
+    const KEYS = 'KEYS';//查找所有符合给定模式( pattern)的 key 。
+    const MOVE = 'MOVE';//将当前数据库的 key 移动到给定的数据库 db 当中。
+    const PERSIST = 'PERSIST';//移除 key 的过期时间,key 将持久保持。
+    const PTTL = 'PTTL';//以毫秒为单位返回 key 的剩余的过期时间。
+    const TTL = 'TTL';//以秒为单位,返回给定 key 的剩余生存时间(TTL, time to live)。
+    const RANDOMKEY = 'RANDOMKEY';//从当前数据库中随机返回一个 key 。
+    const RENAME = 'RENAME';//修改 key 的名称
+    const RENAMENX = 'RENAMENX';//仅当 newkey 不存在时,将 key 改名为 newkey 。
+    const TYPE = 'TYPE';//返回 key 所储存的值的类型。
+
+
+    const SET = 'SET';//设置指定 key 的值
+    const GET = 'GET';//获取指定 key 的值。
+    const GETRANGE = 'GETRANGE';//返回 key 中字符串值的子字符
+    const GETSET = 'GETSET';//将给定 key 的值设为 value ,并返回 key 的旧值(old value)。
+    const MGET = 'MGET';//获取所有(一个或多个)给定 key 的值。
+    const SETEX = 'SETEX';//将值 value 关联到 key ,并将 key 的过期时间设为 seconds (以秒为单位)。
+    const SETNX = 'SETNX';//只有在 key 不存在时设置 key 的值。
+    const SETRANGE = 'SETRANGE';//用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始。
+    const STRLEN = 'STRLEN';//返回 key 所储存的字符串值的长度。
+    const MSET = 'MSET';//同时设置一个或多个 key-value 对。
+    const MSETNX = 'MSETNX';//同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在。
+    const PSETEX = 'PSETEX';//这个命令和 SETEX 命令相似,但它以毫秒为单位设置 key 的生存时间,而不是像 SETEX 命令那样,以秒为单位。
+    const INCR = 'INCR';//将 key 中储存的数字值增一。
+    const INCRBY = 'INCRBY';//将 key 所储存的值加上给定的增量值(increment) 。
+    const INCRBYFLOAT = 'INCRBYFLOAT';//将 key 所储存的值加上给定的浮点增量值(increment) 。
+    const DECR = 'DECR';//将 key 中储存的数字值减一。
+    const DECRBY = 'DECRBY';//key 所储存的值减去给定的减量值(decrement) 。
+    const APPEND = 'APPEND';//如果 key 已经存在并且是一个字符串, APPEND 命令将 value 追加到 key 原来的值的末尾。
+    const SCAN = 'SCAN';//
+
+
+    const HDEL = 'HDEL';//删除一个或多个哈希表字段
+    const HEXISTS = 'HEXISTS';//查看哈希表 key 中,指定的字段是否存在。
+    const HGET = 'HGET';//获取存储在哈希表中指定字段的值/td>
+    const HGETALL = 'HGETALL';//获取在哈希表中指定 key 的所有字段和值
+    const HINCRBY = 'HINCRBY';//为哈希表 key 中的指定字段的整数值加上增量 increment 。
+    const HINCRBYFLOAT = 'HINCRBYFLOAT';//为哈希表 key 中的指定字段的浮点数值加上增量 increment 。
+    const HKEYS = 'HKEYS';//获取所有哈希表中的字段
+    const HLEN = 'HLEN';//获取哈希表中字段的数量
+    const HMGET = 'HMGET';//获取所有给定字段的值
+    const HMSET = 'HMSET';//同时将多个 field-value (域-值)对设置到哈希表 key 中。
+    const HSET = 'HSET';//将哈希表 key 中的字段 field 的值设为 value 。
+    const HSETNX = 'HSETNX';//只有在字段 field 不存在时,设置哈希表字段的值。
+    const HVALS = 'HVALS';//获取哈希表中所有值
+    const HSCAN = 'HSCAN';//迭代哈希表中的键值对。
+
+
+    const BLPOP = 'BLPOP';//移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。
+    const BRPOP = 'BRPOP';//移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。
+    const BRPOPLPUSH = 'BRPOPLPUSH';//从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。
+    const LINDEX = 'LINDEX';//通过索引获取列表中的元素
+    const LINSERT = 'LINSERT';//在列表的元素前或者后插入元素
+    const LLEN = 'LLEN';//获取列表长度
+    const LPOP = 'LPOP';//移出并获取列表的第一个元素
+    const LPUSH = 'LPUSH';//将一个或多个值插入到列表头部
+    const LPUSHX = 'LPUSHX';//将一个或多个值插入到已存在的列表头部
+    const LRANGE = 'LRANGE';//获取列表指定范围内的元素
+    const LREM = 'LREM';//移除列表元素
+    const LSET = 'LSET';//通过索引设置列表元素的值
+    const LTRIM = 'LTRIM';//对一个列表进行修剪(trim),就是说,让列表只保留指定区间内的元素,不在指定区间之内的元素都将被删除。
+    const RPOP = 'RPOP';//移除并获取列表最后一个元素
+    const RPOPLPUSH = 'RPOPLPUSH';//移除列表的最后一个元素,并将该元素添加到另一个列表并返回
+    const RPUSH = 'RPUSH';//在列表中添加一个或多个值
+    const RPUSHX = 'RPUSHX';//为已存在的列表添加值
+
+
+    const SADD = 'SADD';//向集合添加一个或多个成员
+    const SCARD = 'SCARD';//获取集合的成员数
+    const SDIFF = 'SDIFF';//返回给定所有集合的差集
+    const SDIFFSTORE = 'SDIFFSTORE';//返回给定所有集合的差集并存储在 destination 中
+    const SINTER = 'SINTER';//返回给定所有集合的交集
+    const SINTERSTORE = 'SINTERSTORE';//返回给定所有集合的交集并存储在 destination 中
+    const SISMEMBER = 'SISMEMBER';//判断 member 元素是否是集合 key 的成员
+    const SMEMBERS = 'SMEMBERS';//返回集合中的所有成员
+    const SMOVE = 'SMOVE';//将 member 元素从 source 集合移动到 destination 集合
+    const SPOP = 'SPOP';//移除并返回集合中的一个或多个随机元素
+    const SRANDMEMBER = 'SRANDMEMBER';//返回集合中一个或多个随机数
+    const SREM = 'SREM';//移除集合中一个或多个成员
+    const SUNION = 'SUNION';//返回所有给定集合的并集
+    const SUNIONSTORE = 'SUNIONSTORE';//所有给定集合的并集存储在 destination 集合中
+    const SSCAN = 'SSCAN';//迭代集合中的元素
+
+    const GETBIT = 'GETBIT';//对 key 所储存的字符串值,获取指定偏移量上的位(bit)。
+    const SETBIT = 'SETBIT';//对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit)。
+    const BITCOUNT = 'BITCOUNT';//Count the number of set bits (population counting) in a string.
+    const BITPOS = 'BITPOS'; // Return the position of the first bit set to 1 or 0 in a string.
+    const BITOP = 'BITOP'; // Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key.
+    const BITFIELD = 'BITFIELD'; // The command treats a Redis string as a array of bits, and is capable of addressing specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset.
+
+
+    const ZADD = 'ZADD';//向有序集合添加一个或多个成员,或者更新已存在成员的分数
+    const ZCARD = 'ZCARD';//获取有序集合的成员数
+    const ZCOUNT = 'ZCOUNT';//计算在有序集合中指定区间分数的成员数
+    const ZINCRBY = 'ZINCRBY';//有序集合中对指定成员的分数加上增量 increment
+    const ZINTERSTORE = 'ZINTERSTORE';//计算给定的一个或多个有序集的交集并将结果集存储在新的有序集合 key 中
+    const ZLEXCOUNT = 'ZLEXCOUNT';//在有序集合中计算指定字典区间内成员数量
+    const ZRANGE = 'ZRANGE';//通过索引区间返回有序集合成指定区间内的成员
+    const ZPOPMAX = 'ZPOPMAX';//删除并返回有序集合中的一个或多个具有最高得分的成员
+    const ZPOPMIN = 'ZPOPMIN';//删除并返回有序集合中的一个或多个具有最低得分的成员
+    const ZRANGEBYLEX = 'ZRANGEBYLEX';//通过字典区间返回有序集合的成员
+    const ZRANGEBYSCORE = 'ZRANGEBYSCORE';//通过分数返回有序集合指定区间内的成员
+    const ZRANK = 'ZRANK';//返回有序集合中指定成员的索引
+    const ZREM = 'ZREM';//移除有序集合中的一个或多个成员
+    const ZREMRANGEBYLEX = 'ZREMRANGEBYLEX';//移除有序集合中给定的字典区间的所有成员
+    const ZREMRANGEBYRANK = 'ZREMRANGEBYRANK';//移除有序集合中给定的排名区间的所有成员
+    const ZREMRANGEBYSCORE = 'ZREMRANGEBYSCORE';//移除有序集合中给定的分数区间的所有成员
+    const ZREVRANGE = 'ZREVRANGE';//返回有序集中指定区间内的成员,通过索引,分数从高到底
+    const ZREVRANGEBYSCORE = 'ZREVRANGEBYSCORE';//返回有序集中指定分数区间内的成员,分数从高到低排序
+    const ZREVRANK = 'ZREVRANK';//返回有序集合中指定成员的排名,有序集成员按分数值递减(从大到小)排序
+    const ZSCORE = 'ZSCORE';//返回有序集中,成员的分数值
+    const ZUNIONSTORE = 'ZUNIONSTORE';//计算给定的一个或多个有序集的并集,并存储在新的 key 中
+    const ZSCAN = 'ZSCAN';//迭代有序集合中的元素(包括元素成员和元素分值)
+    const BZPOPMAX = 'BZPOPMAX';
+    const BZPOPMIN = 'BZPOPMIN';
+
+
+    const XADD = 'XADD'; //向指定stream添加数据
+    const XLEN = 'XLEN'; //返回指定stream的item的个数
+    const XDEL = 'XDEL'; //删除指定steam的item
+    const XRANGE = 'XRANGE';//查询指定stream范围内的item
+    const XREVRANGE = 'XREVRANGE';//同上 不过是倒叙输出
+    const XREAD = 'XREAD';//监听指定stream
+    const XGROUP = 'XGROUP';//创建 管理 删除group
+    const XREADGROUP = 'XREADGROUP';//读取消息进行消费
+    const XACK = 'XACK'; //通知group成功处理消息
+    const XINFO = 'XINFO'; //获取stream或者group信息
+    const XCLAIM = 'XCLAIM'; //改变message的所属关系
+    const XPENDING = 'XPENDING';//查看组内的pending message信息
+    const XTRIM = 'XTRIM';//将流修剪为给定数量的项目
+
+    const PFADD = 'PFADD';//添加指定元素到 HyperLogLog 中。
+    const PFCOUNT = 'PFCOUNT';//返回给定 HyperLogLog 的基数估算值。
+    const PFMERGE = 'PFMERGE';//将多个 HyperLogLog 合并为一个 HyperLogLog
+
+    const PSUBSCRIBE = 'PSUBSCRIBE';//订阅一个或多个符合给定模式的频道。
+    const PUBSUB = 'PUBSUB';//查看订阅与发布系统状态。
+    const PUBLISH = 'PUBLISH';//将信息发送到指定的频道。
+    const PUNSUBSCRIBE = 'PUNSUBSCRIBE';//退订所有给定模式的频道。
+    const SUBSCRIBE = 'SUBSCRIBE';//订阅给定的一个或多个频道的信息。
+    const UNSUBSCRIBE = 'UNSUBSCRIBE';//指退订给定的频道。
+
+    const DISCARD = 'DISCARD';//取消事务,放弃执行事务块内的所有命令。
+    const EXEC = 'EXEC';//执行所有事务块内的命令。
+    const MULTI = 'MULTI';//标记一个事务块的开始。
+    const UNWATCH = 'UNWATCH';//取消 WATCH 命令对所有 key 的监视。
+    const WATCH = 'WATCH';//监视一个(或多个) key ,如果在事务执行之前这个(或这些) key 被其他命令所改动,那么事务将被打断。
+
+
+    const EVAL = 'EVAL';//执行 Lua 脚本。
+    const EVALSHA = 'EVALSHA';//执行 Lua 脚本。
+    const SCRIPT = 'SCRIPT';//查看指定的脚本是否已经被保存在缓存当中。
+    const SCRIPT_EXISTS = 'SCRIPT EXISTS';//查看指定的脚本是否已经被保存在缓存当中。
+    const SCRIPT_FLUSH = 'SCRIPT FLUSH';//查看指定的脚本是否已经被保存在缓存当中。
+    const SCRIPT_KILL = 'SCRIPT KILL';//查看指定的脚本是否已经被保存在缓存当中。
+    const SCRIPT_LOAD = 'SCRIPT LOAD';//查看指定的脚本是否已经被保存在缓存当中。
+
+
+    const AUTH = 'AUTH';//验证密码是否正确
+    const ECHO = 'ECHO';//打印字符串
+    const PING = 'PING';//查看服务是否运行
+    const QUIT = 'QUIT';//关闭当前连接
+    const SELECT = 'SELECT';//切换到指定的数据库
+
+
+    const BGREWRITEAOF = 'BGREWRITEAOF';//异步执行一个 AOF(AppendOnly File) 文件重写操作
+    const BGSAVE = 'BGSAVE';//在后台异步保存当前数据库的数据到磁盘
+    const CLIENT = 'CLIENT';//关闭客户端连接
+    const COMMAND = 'COMMAND';//获取 Redis 命令详情数组
+    const COMMAND_COUNT = 'COMMAND COUNT';//获取 Redis 命令详情数组
+    const TIME = 'TIME';//返回当前服务器时间
+    const CONFIG = 'CONFIG';//获取指定配置参数的值
+    const DBSIZE = 'DBSIZE';//返回当前数据库的 key 的数量
+    const DEBUG = 'DEBUG';//获取 key 的调试信息
+    const FLUSHALL = 'FLUSHALL';//删除所有数据库的所有key
+    const FLUSHDB = 'FLUSHDB';//删除当前数据库的所有key
+    const INFO = 'INFO';//获取 Redis 服务器的各种信息和统计数值
+    const LASTSAVE = 'LASTSAVE';//返回最近一次 Redis 成功将数据保存到磁盘上的时间,以 UNIX 时间戳格式表示
+    const MONITOR = 'MONITOR';//实时打印出 Redis 服务器接收到的命令,调试用
+    const ROLE = 'ROLE';//返回主从实例所属的角色
+    const SAVE = 'SAVE';//异步保存数据到硬盘
+    const SHUTDOWN = 'SHUTDOWN';//异步保存数据到硬盘,并关闭服务器
+    const SLAVEOF = 'SLAVEOF';//将当前服务器转变为指定服务器的从属服务器(slave server)
+    const SLOWLOG = 'SLOWLOG';//管理 redis 的慢日志
+    const SYNC = 'SYNC';//用于复制功能(replication)的内部命令
+
+
+    const GEOADD = 'GEOADD';
+    const GEODIST = 'GEODIST';
+    const GEOHASH = 'GEOHASH';
+    const GEOPOS = 'GEOPOS';
+    const GEORADIUS = 'GEORADIUS';
+    const GEORADIUSBYMEMBER = 'GEORADIUSBYMEMBER';
+
+
+    const CLUSTER = 'CLUSTER';//获取集群节点的映射数组
+    const READONLY = 'READONLY';//集群相关命令
+    const READWRITE = 'READWRITE';//集群相关命令
+}

+ 189 - 0
vendor/easyswoole/redis/src/CommandHandle/AbstractCommandHandle.php

@@ -0,0 +1,189 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: tioncico
+ * Date: 19-10-3
+ * Time: 下午6:19
+ */
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\Config\RedisConfig;
+use EasySwoole\Redis\CrcHash;
+use EasySwoole\Redis\Exception\RedisClusterException;
+use EasySwoole\Redis\Exception\RedisException;
+use EasySwoole\Redis\Pipe;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\RedisCluster;
+use EasySwoole\Redis\RedisTransaction;
+use EasySwoole\Redis\Response;
+
+Abstract class AbstractCommandHandle
+{
+    //命令名称
+    protected $commandName;
+    //$redis实例
+    protected $redis;
+    //命令key值
+    protected $key;
+    //slot值
+    protected $slot;
+    protected $commandData;
+
+    function __construct(Redis $redis)
+    {
+        $this->redis = $redis;
+    }
+
+    function getCommand(...$data)
+    {
+        $commandData = $this->handelCommandData(...$data);
+        //开启了管道
+        if ($this->redis->getPipe() && $this->redis->getPipe()->isStartPipe() == true) {
+            $this->redis->getPipe()->addCommand([$this->commandName, $commandData]);
+            //事务命令忽略
+            if (!in_array(strtolower($this->commandName), Pipe::IGNORE_COMMAND)) {
+                return ['PIPE'];
+            }
+        }
+
+        $this->commandData = $commandData;
+        if (!in_array($this->commandName, ['StartPipe', 'ExecPipe'])) {
+            $this->onBeforeEvent($this->commandData);
+        }
+        return $commandData;
+    }
+
+    function getData(Response $recv)
+    {
+        //开启了事务
+        if ($this->redis->getTransaction() && $this->redis->getTransaction()->isTransaction() == true) {
+            $this->redis->getTransaction()->addCommand([$this->commandName, $this->commandData]);
+            //事务命令忽略
+            if (!in_array(strtolower($this->commandName), RedisTransaction::IGNORE_COMMAND)) {
+                return 'QUEUED';
+            }
+        }
+
+        //开启了管道
+        if ($this->redis->getPipe() && $this->redis->getPipe()->isStartPipe() == true) {
+            //事务命令忽略
+            if (!in_array(strtolower($this->commandName), Pipe::IGNORE_COMMAND)) {
+                return 'PIPE';
+            }
+        }
+
+        if ($recv->getStatus() != $recv::STATUS_OK) {
+            $this->redis->setErrorType($recv->getErrorType());
+            $this->redis->setErrorMsg($recv->getMsg());
+            if ($this->redis instanceof RedisCluster) {
+                throw new RedisClusterException($recv->getMsg(), $recv->getErrorType());
+            } else {
+                throw new RedisException($recv->getMsg(), $recv->getErrorType());
+            }
+        }
+        $result = $this->handelRecv($recv);
+
+        if (!in_array($this->commandName, ['StartPipe', 'ExecPipe'])) {
+            $this->onAfterEvent($this->commandData, $result);
+        }
+        return $result;
+    }
+
+    abstract function handelCommandData(...$data);
+
+    abstract function handelRecv(Response $recv);
+
+    /**
+     * @return mixed
+     */
+    public function getCommandName()
+    {
+        return $this->commandName;
+    }
+
+    protected function serialize($val)
+    {
+        switch ($this->redis->getConfig()->getSerialize()) {
+            case RedisConfig::SERIALIZE_PHP:
+                return serialize($val);
+                break;
+            case RedisConfig::SERIALIZE_JSON:
+                return json_encode($val, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
+                break;
+            default:
+            case RedisConfig::SERIALIZE_NONE:
+                return $val;
+                break;
+        }
+    }
+
+    protected function unSerialize($val)
+    {
+        switch ($this->redis->getConfig()->getSerialize()) {
+            case RedisConfig::SERIALIZE_PHP:
+                {
+                    $res = unserialize($val);
+                    return $res !== false ? $res : $val;
+                    break;
+                }
+
+            case RedisConfig::SERIALIZE_JSON:
+                {
+                    $res = json_decode($val, true);
+                    return $res !== null ? $res : $val;
+                    break;
+                }
+            default:
+            case RedisConfig::SERIALIZE_NONE:
+                {
+                    return $val;
+                    break;
+                }
+        }
+    }
+
+    protected function setClusterExecClientByKey($key)
+    {
+        if ($this->redis instanceof RedisCluster) {
+            /**
+             * @var $redis RedisCluster
+             */
+            $redis = $this->redis;
+            $client = $redis->getClientBySlotId(CrcHash::getRedisSlot($key));
+            $redis->setDefaultClient($client);
+        }
+    }
+
+    protected function onBeforeEvent($commandData)
+    {
+        if (is_callable($this->redis->getConfig()->getBeforeEvent())) {
+            $commandName = array_shift($commandData);
+            call_user_func($this->redis->getConfig()->getBeforeEvent(), $commandName, $commandData);
+        }
+    }
+
+    protected function onAfterEvent($commandData, $result)
+    {
+        if (in_array($this->commandName, ['StartPipe', 'ExecPipe']) || ($this->redis->getPipe() && $this->redis->getPipe()->isStartPipe() == true)) {
+            return;
+        }
+        if (is_callable($this->redis->getConfig()->getAfterEvent())) {
+            $commandName = array_shift($commandData);
+            call_user_func($this->redis->getConfig()->getAfterEvent(), $commandName, $commandData, $result);
+        }
+    }
+
+    /**
+     * 兼容event hook+pipe
+     * setCommandData
+     * @param $commandData
+     * @author tioncico
+     * Time: 14:08
+     */
+    public function setCommandData($commandData)
+    {
+        $this->commandData = $commandData;
+    }
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/AppEnd.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class AppEnd extends AbstractCommandHandle
+{
+	public $commandName = 'AppEnd';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $value=array_shift($data);
+
+		$command = [CommandConst::APPEND,$key,$value];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/Auth.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Auth extends AbstractCommandHandle
+{
+	public $commandName = 'Auth';
+
+
+	public function handelCommandData(...$data)
+	{
+		$password=array_shift($data);
+
+		$command = [CommandConst::AUTH,$password];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 38 - 0
vendor/easyswoole/redis/src/CommandHandle/BLPop.php

@@ -0,0 +1,38 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class BLPop extends AbstractCommandHandle
+{
+	public $commandName = 'BLPop';
+
+
+	public function handelCommandData(...$data)
+	{
+		$keys=array_shift($data);
+		$timeout=array_shift($data);
+		if (is_string($keys)){
+		    $keys = [$keys];
+        }
+
+		$command = array_merge([CommandConst::BLPOP],$keys);
+        $command[] = $timeout;
+		$commandData = $command;
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+	    $data = $recv->getData();
+
+	    if (is_array($data)){
+            return [$data[0] => $this->unSerialize($data[1])];
+        }else{
+	        return $data;
+        }
+	}
+}

+ 37 - 0
vendor/easyswoole/redis/src/CommandHandle/BRPop.php

@@ -0,0 +1,37 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class BRPop extends AbstractCommandHandle
+{
+	public $commandName = 'BRPop';
+
+
+	public function handelCommandData(...$data)
+	{
+        $keys=array_shift($data);
+        $timeout=array_shift($data);
+        if (is_string($keys)){
+            $keys = [$keys];
+        }
+
+        $command = array_merge([CommandConst::BRPOP],$keys);
+        $command[] = $timeout;
+        $commandData = $command;
+        return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+        $data = $recv->getData();
+        if (is_array($data)){
+            return [$data[0] => $this->unSerialize($data[1])];
+        }else{
+            return $data;
+        }
+	}
+}

+ 30 - 0
vendor/easyswoole/redis/src/CommandHandle/BRPopLPush.php

@@ -0,0 +1,30 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class BRPopLPush extends AbstractCommandHandle
+{
+	public $commandName = 'BRPopLPush';
+
+
+	public function handelCommandData(...$data)
+	{
+		$source=array_shift($data);
+		$destination=array_shift($data);
+		$timeout=array_shift($data);
+
+		$command = [CommandConst::BRPOPLPUSH,$source,$destination,$timeout];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		$data = $recv->getData();
+		return $this->unSerialize($data);
+	}
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/BZPopMax.php

@@ -0,0 +1,33 @@
+<?php
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BZPopMax extends AbstractCommandHandle
+{
+    public $commandName = 'BZPOPMAX';
+
+    public function handelCommandData(...$data)
+    {
+        $keys = array_shift($data);
+        $keys = is_array($keys) ? $keys : [$keys];
+        $timeout = array_shift($data);
+
+        return array_merge([CommandConst::BZPOPMAX], $keys, [$timeout]);
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+
+        if ($data) {
+            $data[1] = $this->unSerialize($data[1]);
+        }
+
+        return $data;
+    }
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/BZPopMin.php

@@ -0,0 +1,33 @@
+<?php
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BZPopMin extends AbstractCommandHandle
+{
+    public $commandName = 'BZPOPMIN';
+
+    public function handelCommandData(...$data)
+    {
+        $keys = array_shift($data);
+        $keys = is_array($keys) ? $keys : [$keys];
+        $timeout = array_shift($data);
+
+        return array_merge([CommandConst::BZPOPMIN], $keys, [$timeout]);
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+
+        if ($data) {
+            $data[1] = $this->unSerialize($data[1]);
+        }
+
+        return $data;
+    }
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/BgRewriteAof.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class BgRewriteAof extends AbstractCommandHandle
+{
+	public $commandName = 'BgReWriteAof';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::BGREWRITEAOF];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/BgSave.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class BgSave extends AbstractCommandHandle
+{
+	public $commandName = 'BgSave';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::BGSAVE];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 40 - 0
vendor/easyswoole/redis/src/CommandHandle/BitCount.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * @author gaobinzhan <gaobinzhan@gmail.com>
+ */
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BitCount extends AbstractCommandHandle
+{
+    protected $commandName = 'BITCOUNT';
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $start = array_shift($data);
+        $end = array_shift($data);
+
+        $commandData = [CommandConst::BITCOUNT, $key];
+
+        if ($start !== null) {
+            $commandData = array_merge($commandData, [$start]);
+            if ($end !== null) {
+                $commandData = array_merge($commandData, [$end]);
+            }
+        }
+
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 53 - 0
vendor/easyswoole/redis/src/CommandHandle/BitField.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * @author gaobinzhan <gaobinzhan@gmail.com>
+ */
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BitField extends AbstractCommandHandle
+{
+    protected $commandName = 'BITFIELD';
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $subcommands = array_shift($data);
+        $overflow = array_shift($data);
+        $subcommandArgs = array_shift($data);
+
+        $commandData = [CommandConst::BITFIELD, $key];
+
+        if (count($subcommands) === count($subcommands, 1)) {
+            $commandData = array_merge($commandData, $subcommands);
+        } else {
+            foreach ($subcommands as $subcommand) {
+                $commandData = array_merge($commandData, $subcommand);
+            }
+        }
+
+        if ($overflow !== null) {
+            $commandData = array_merge($commandData, ['OVERFLOW', $overflow]);
+            if (count($subcommandArgs) === count($subcommandArgs, 1)) {
+                $commandData = array_merge($commandData, $subcommandArgs);
+            } else {
+                foreach ($subcommandArgs as $subcommandArg) {
+                    $commandData = array_merge($commandData, $subcommandArg);
+                }
+            }
+        }
+
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 37 - 0
vendor/easyswoole/redis/src/CommandHandle/BitOp.php

@@ -0,0 +1,37 @@
+<?php
+/**
+ * @author gaobinzhan <gaobinzhan@gmail.com>
+ */
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BitOp extends AbstractCommandHandle
+{
+    protected $commandName = 'BITOP';
+
+    public function handelCommandData(...$data)
+    {
+        $operation = array_shift($data);
+        $destKey = array_shift($data);
+        $this->setClusterExecClientByKey($destKey);
+        $key = array_shift($data);
+        $otherKeys = array_shift($data);
+
+        $commandData = [CommandConst::BITOP, $operation, $destKey, $key];
+
+        if ($otherKeys) {
+            $commandData = array_merge($commandData, $otherKeys);
+        }
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 40 - 0
vendor/easyswoole/redis/src/CommandHandle/BitPos.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * @author gaobinzhan <gaobinzhan@gmail.com>
+ */
+
+
+namespace EasySwoole\Redis\CommandHandle;
+
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class BitPos extends AbstractCommandHandle
+{
+    protected $commandName = 'BITPOS';
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $bit = array_shift($data);
+        $start = array_shift($data);
+        $end = array_shift($data);
+
+        $commandData = [CommandConst::BITPOS, $key, $bit];
+
+        if ($start !== null) {
+            $commandData = array_merge($commandData, [$start]);
+            if ($end !== null) {
+                $commandData = array_merge($commandData, [$end]);
+            }
+        }
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/ClientGetName.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ClientGetName extends AbstractCommandHandle
+{
+	public $commandName = 'ClientGetName';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::CLIENT,'GETNAME'];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClientKill.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ClientKill extends AbstractCommandHandle
+{
+	public $commandName = 'ClientKill';
+
+
+	public function handelCommandData(...$data)
+	{
+		$data=array_shift($data);
+
+		$command = [CommandConst::CLIENT,'KILL',$data];
+		$commandData = array_merge($command);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 40 - 0
vendor/easyswoole/redis/src/CommandHandle/ClientList.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ClientList extends AbstractCommandHandle
+{
+    public $commandName = 'ClientList';
+
+
+    public function handelCommandData(...$data)
+    {
+
+        $command = [CommandConst::CLIENT, 'LIST'];
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+        $result = [];
+        foreach (explode(PHP_EOL, $data) as $clientKey => $value) {
+            if (empty($value)) {
+                continue;
+            }
+            $arr = explode(' ', $value);
+            $result[$clientKey] = [];
+            foreach ($arr as $kv) {
+                $kvArr = explode('=', $kv);
+                $result[$clientKey][$kvArr[0]] = $kvArr[1];
+            }
+        }
+        return $result;
+    }
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClientPause.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ClientPause extends AbstractCommandHandle
+{
+	public $commandName = 'ClientPause';
+
+
+	public function handelCommandData(...$data)
+	{
+		$timeout=array_shift($data);
+
+		$command = [CommandConst::CLIENT,'PAUSE',$timeout];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClientSetName.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ClientSetName extends AbstractCommandHandle
+{
+	public $commandName = 'ClientSetName';
+
+
+	public function handelCommandData(...$data)
+	{
+		$connectionName=array_shift($data);
+
+		$command = [CommandConst::CLIENT,'SETNAME',$connectionName];
+		$commandData = array_merge($command);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterAddSlots.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterAddSlots extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterAddSlots';
+
+    public function handelCommandData(...$data)
+    {
+        $slot = array_shift($data);
+        if (is_array($slot)) {
+            $command = [CommandConst::CLUSTER, 'ADDSLOTS'];
+            $commandData = array_merge($command, $slot);
+        } else {
+            $command = [CommandConst::CLUSTER, 'ADDSLOTS', $slot];
+            $commandData = $command;
+        }
+
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv): bool
+    {
+        return true;
+    }
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterCountFailureReports.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterCountFailureReports extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterCountFailureReports';
+
+    public function handelCommandData(...$data)
+    {
+        $nodeId = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'COUNT-FAILURE-REPORTS',$nodeId];
+        $commandData = array_merge($command,$data);
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterCountKeySinSlot.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterCountKeySinSlot extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterCountKeySinSlot';
+
+    public function handelCommandData(...$data)
+    {
+        $slot = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'COUNTKEYSINSLOT',$slot];
+        $commandData = array_merge($command,$data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterDelSlots.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterDelSlots extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterDelSlots';
+
+
+    public function handelCommandData(...$data)
+    {
+        $slot = array_shift($data);
+        if (is_array($slot)) {
+            $command = [CommandConst::CLUSTER, 'DELSLOTS'];
+            $commandData = array_merge($command, $slot);
+        } else {
+            $command = [CommandConst::CLUSTER, 'DELSLOTS', $slot];
+            $commandData = $command;
+        }
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv): bool
+    {
+        return true;
+    }
+}

+ 30 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterFailOver.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterFailOver extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterFailOver';
+
+
+    public function handelCommandData(...$data)
+    {
+        $option = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'FAILOVER'];
+        if ($option){
+            $command[]= $option;
+        }
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterForget.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterForget extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterForget';
+
+
+    public function handelCommandData(...$data)
+    {
+        $nodeId = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'FORGET', $nodeId];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterGetKeySinSlot.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterGetKeySinSlot extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterGetKeySinSlot';
+
+
+    public function handelCommandData(...$data)
+    {
+        $slot = array_shift($data);
+        $count = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'GETKEYSINSLOT',$slot,$count];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 34 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterInfo.php

@@ -0,0 +1,34 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterInfo extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterInfo';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::CLUSTER, 'INFO'];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $result = [];
+        foreach (explode("\r\n",$recv->getData()) as $value){
+            if (empty($value)){
+                continue;
+            }
+            $kvArr = explode(':',$value);
+            $result[$kvArr[0]] = $kvArr[1];
+        }
+        return $result;
+    }
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterKeySlot.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterKeySlot extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterKeySlot';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'KEYSLOT', $key];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterMeet.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterMeet extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterMeet';
+
+
+    public function handelCommandData(...$data)
+    {
+        $ip = array_shift($data);
+        $port = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'MEET', $ip,$port];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 55 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterNodes.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterNodes extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterNodes';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::CLUSTER, 'NODES'];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $list = explode(PHP_EOL, $recv->getData());
+        $nodeList = [];
+        foreach ($list as $serverData) {
+            $data = explode(' ', $serverData);
+            if (empty($data[0])) {
+                continue;
+            }
+            list($host, $port) = explode(':', explode('@', $data[1])[0]);
+            $node = [
+                'name'      => $data[0],
+                'host'      => $host,
+                'port'      => $port,
+                'flags'     => $data[2],
+                'connected' => $data[7],
+                'slotList'  => $this->getSlotList($data),
+            ];
+            $nodeList[$node['name']] = $node;
+        }
+        return $nodeList;
+    }
+
+    protected function getSlotList($data)
+    {
+        $slotList = [];
+        //获取8后面的数据
+        $slotOriginalData = array_slice($data, 8);
+        foreach ($slotOriginalData as $slotString) {
+            $slotList[] = explode('-', $slotString);
+        }
+        return $slotList;
+    }
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterReplicate.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterReplicate extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterReplicate';
+
+
+    public function handelCommandData(...$data)
+    {
+        $nodeId = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'REPLICATE', $nodeId];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 30 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterReset.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterReset extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterReset';
+
+
+    public function handelCommandData(...$data)
+    {
+        $option = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'RESET'];
+        if ($option){
+            $command[] = $option;
+        }
+        $commandData = array_merge($command,$data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSaveConfig.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterSaveConfig extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterSaveConfig';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::CLUSTER, 'SAVECONFIG'];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSetConfigEpoch.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterSetConfigEpoch extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterSetConfigEpoch';
+
+    public function handelCommandData(...$data)
+    {
+        $configEpoch = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'SET-CONFIG-EPOCH',$configEpoch];
+        $commandData = array_merge($command,$data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return $recv->getData();
+    }
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSetSlot.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterSetSlot extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterSetSlot';
+
+
+    public function handelCommandData(...$data)
+    {
+        $slot  = array_shift($data);
+        $subCommand  = array_shift($data);
+        $nodeId  = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'SETSLOT', $slot, $subCommand];
+        if ($nodeId){
+            $command[] = $nodeId;
+        }
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSlaves.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterSlaves extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterSlaves';
+
+    public function handelCommandData(...$data)
+    {
+        $nodeId  = array_shift($data);
+        $command = [CommandConst::CLUSTER, 'SLAVES', $nodeId];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/ClusterSlots.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class ClusterSlots extends AbstractCommandHandle
+{
+    public $commandName = 'ClusterSlaves';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::CLUSTER, 'SLOTS'];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/Readonly.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class Readonly extends AbstractCommandHandle
+{
+    public $commandName = 'Readonly';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::READONLY];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/ClusterCommand/Readwrite.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle\ClusterCommand;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\CommandHandle\AbstractCommandHandle;
+use EasySwoole\Redis\Response;
+
+class Readwrite extends AbstractCommandHandle
+{
+    public $commandName = 'Readwrite';
+
+
+    public function handelCommandData(...$data)
+    {
+        $command = [CommandConst::READWRITE];
+        $commandData = array_merge($command);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv):bool
+    {
+        return true;
+    }
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/Command.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Command extends AbstractCommandHandle
+{
+	public $commandName = 'Command';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::COMMAND];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/CommandCount.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class CommandCount extends AbstractCommandHandle
+{
+	public $commandName = 'CommandCount';
+
+
+	public function handelCommandData(...$data)
+	{
+
+
+		$command = [CommandConst::COMMAND,'COUNT'];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/CommandGetKeys.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class CommandGetKeys extends AbstractCommandHandle
+{
+	public $commandName = 'CommandGetKeys';
+
+
+	public function handelCommandData(...$data)
+	{
+
+
+		$command = [CommandConst::COMMAND,'GETKEYS'];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/CommandInfo.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class CommandInfo extends AbstractCommandHandle
+{
+	public $commandName = 'CommandInfo';
+
+
+	public function handelCommandData(...$data)
+	{
+		$commandName=array_shift($data);
+
+		$command = [CommandConst::COMMAND, 'INFO',$commandName];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ConfigGet.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ConfigGet extends AbstractCommandHandle
+{
+	public $commandName = 'ConfigGet';
+
+
+	public function handelCommandData(...$data)
+	{
+		$parameter=array_shift($data);
+
+		$command = [CommandConst::CONFIG,'GET',$parameter];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/ConfigResetStat.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ConfigResetStat extends AbstractCommandHandle
+{
+	public $commandName = 'ConfigResetStat';
+
+
+	public function handelCommandData(...$data)
+	{
+
+
+		$command = [CommandConst::CONFIG,'RESETSTAT'];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/ConfigRewrite.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ConfigRewrite extends AbstractCommandHandle
+{
+	public $commandName = 'ConfigRewrite';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::CONFIG,'REWRITE'];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/ConfigSet.php

@@ -0,0 +1,28 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ConfigSet extends AbstractCommandHandle
+{
+	public $commandName = 'ConfigSet';
+
+
+	public function handelCommandData(...$data)
+	{
+		$parameter=array_shift($data);
+		$value=array_shift($data);
+
+		$command = [CommandConst::CONFIG,'SET',$parameter,$value];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/Construct.php

@@ -0,0 +1,28 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Construct extends AbstractCommandHandle
+{
+	public static $commandName = 'Construct';
+
+
+	public static function handelCommandData(...$data)
+	{
+		$config=array_shift($data);
+
+
+		$command = [CommandConst::CONSTRUCT,$config];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public static function handelRecv(Redis $redis, Response $recv)
+	{
+		$this->config = $config;
+	}
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/DBSize.php

@@ -0,0 +1,26 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class DBSize extends AbstractCommandHandle
+{
+	public $commandName = 'DBSize';
+
+
+	public function handelCommandData(...$data)
+	{
+
+		$command = [CommandConst::DBSIZE];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/DebugObject.php

@@ -0,0 +1,28 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class DebugObject extends AbstractCommandHandle
+{
+	public $commandName = 'DebugObject';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+
+
+		$command = [CommandConst::DEBUG,'OBJECT',$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/DebugSegfault.php

@@ -0,0 +1,26 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class DebugSegfault extends AbstractCommandHandle
+{
+	public $commandName = 'DebugSegfault';
+
+
+	public function handelCommandData(...$data)
+	{
+
+		$command = [CommandConst::DEBUGSEGFAULT];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 30 - 0
vendor/easyswoole/redis/src/CommandHandle/Decr.php

@@ -0,0 +1,30 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Decr extends AbstractCommandHandle
+{
+	public $commandName = 'Decr';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+
+
+
+
+		$command = [CommandConst::DECR,$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 31 - 0
vendor/easyswoole/redis/src/CommandHandle/DecrBy.php

@@ -0,0 +1,31 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class DecrBy extends AbstractCommandHandle
+{
+	public $commandName = 'DecrBy';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+		$value=array_shift($data);
+
+
+
+
+		$command = [CommandConst::DECRBY,$key,$value];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/Del.php

@@ -0,0 +1,32 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Del extends AbstractCommandHandle
+{
+	public $commandName = 'Del';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+		if (is_array($key)){
+            $command = [CommandConst::DEL];
+            $commandData = array_merge($command,$key);
+        }else{
+            $command = [CommandConst::DEL,$key];
+            $commandData = array_merge($command,$data);
+        }
+
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/Discard.php

@@ -0,0 +1,27 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Discard extends AbstractCommandHandle
+{
+	public $commandName = 'Discard';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::DISCARD];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+        $this->redis->getTransaction()->setCommandLog([]);
+        $this->redis->getTransaction()->setIsTransaction(false);
+		return true;
+	}
+}

+ 27 - 0
vendor/easyswoole/redis/src/CommandHandle/DiscardPipe.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class DiscardPipe extends AbstractCommandHandle
+{
+    public $commandName = 'DiscardPipe';
+
+
+    public function handelCommandData(...$data)
+    {
+
+        $this->redis->getPipe()->setIsStartPipe(false);
+        return true;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $this->redis->getPipe()->setCommandLog([]);
+        return true;
+    }
+}

+ 28 - 0
vendor/easyswoole/redis/src/CommandHandle/Dump.php

@@ -0,0 +1,28 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Dump extends AbstractCommandHandle
+{
+	public $commandName = 'Dump';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+
+        $command = [CommandConst::DUMP,$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 48 - 0
vendor/easyswoole/redis/src/CommandHandle/Exec.php

@@ -0,0 +1,48 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Exec extends AbstractCommandHandle
+{
+	public $commandName = 'Exec';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::EXEC];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+	    $data = $recv->getData();
+	    $commandLog = $this->redis->getTransaction()->getCommandLog();
+        $this->redis->getTransaction()->setCommandLog([]);
+        $this->redis->getTransaction()->setIsTransaction(false);
+        if ($data===null){
+            return $data;
+        }
+        foreach ($data as $k=>$value){
+            $command = array_shift($commandLog);
+	        $commandClassName = "\\EasySwoole\\Redis\\CommandHandle\\".$command[0];
+            /**
+             * @var $commandClass AbstractCommandHandle
+             */
+	        $commandClass = new $commandClassName($this->redis);
+            //兼容hook event
+            $commandClass->setCommandData($command[1]);
+
+	        $response = new Response();
+            $response->setData($value);
+            $response->setStatus($response::STATUS_OK);
+            $data[$k] = $commandClass->getData($response);
+        }
+
+		return $data;
+	}
+}

+ 55 - 0
vendor/easyswoole/redis/src/CommandHandle/ExecPipe.php

@@ -0,0 +1,55 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ExecPipe extends AbstractCommandHandle
+{
+    public $commandName = 'ExecPipe';
+
+
+    public function handelCommandData(...$data)
+    {
+        $commandLog = $this->redis->getPipe()->getCommandLog();
+        $this->redis->getPipe()->setIsStartPipe(false);
+        $commandData = '';
+        foreach ($commandLog as $command) {
+            //兼容hook event
+            $this->onBeforeEvent($command[1]);
+
+            $argNum = count($command[1]);
+            $str = "*{$argNum}\r\n";
+            foreach ($command[1] as $value) {
+                $len = strlen($value);
+                $str = $str . '$' . "{$len}\r\n{$value}\r\n";
+            }
+
+            $commandData .= "{$str}";
+        }
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $commandLog = $this->redis->getPipe()->getCommandLog();
+        $this->redis->getPipe()->setCommandLog([]);
+        $data = [];
+        foreach ($commandLog as $k => $command) {
+            $commandClassName = "\\EasySwoole\\Redis\\CommandHandle\\" . $command[0];
+            /**
+             * @var $commandClass AbstractCommandHandle
+             */
+            $commandClass = new $commandClassName($this->redis);
+            //兼容hook event
+            $commandClass->setCommandData($command[1]);
+            //获取返回tcp数据
+            $response = $this->redis->recv($this->redis->getConfig()->getTimeout());
+            $data[$k] = $commandClass->getData($response);
+        }
+        return $data;
+    }
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/Exists.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Exists extends AbstractCommandHandle
+{
+	public $commandName = 'Exists';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+
+        $this->setClusterExecClientByKey($key);
+
+		$command = [CommandConst::EXISTS,$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/Expire.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class Expire extends AbstractCommandHandle
+{
+	public $commandName = 'Expire';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $expireTime=array_shift($data);
+
+		$command = [CommandConst::EXPIRE,$key,$expireTime];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/ExpireAt.php

@@ -0,0 +1,32 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class ExpireAt extends AbstractCommandHandle
+{
+	public $commandName = 'ExpireAt';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $expireTime=array_shift($data);
+
+
+
+
+		$command = [CommandConst::EXPIREAT,$key,$expireTime];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/FlushAll.php

@@ -0,0 +1,25 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class FlushAll extends AbstractCommandHandle
+{
+	public $commandName = 'FlushAll';
+
+
+	public function handelCommandData(...$data)
+	{
+		$command = [CommandConst::FLUSHALL];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 26 - 0
vendor/easyswoole/redis/src/CommandHandle/FlushDb.php

@@ -0,0 +1,26 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class FlushDb extends AbstractCommandHandle
+{
+	public $commandName = 'FlushDb';
+
+
+	public function handelCommandData(...$data)
+	{
+
+		$command = [CommandConst::FLUSHDB];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return true;
+	}
+}

+ 34 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoAdd.php

@@ -0,0 +1,34 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoAdd extends AbstractCommandHandle
+{
+	public $commandName = 'GeoAdd';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $data = array_shift($data);
+        $command = [CommandConst::GEOADD,$key];
+        foreach ($data as $locationData){
+            $command[] = $locationData['longitude']??$locationData[0];
+            $command[] = $locationData['latitude']??$locationData[1];
+            $command[] = $locationData['name']??$locationData[2];
+        }
+
+		$commandData = array_merge($command);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 31 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoDist.php

@@ -0,0 +1,31 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoDist extends AbstractCommandHandle
+{
+	public $commandName = 'GeoDist';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $location1=array_shift($data);
+		$location2=array_shift($data);
+		$unit=array_shift($data);
+
+		$command = [CommandConst::GEODIST,$key,$location1,$location2,$unit];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoHash.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoHash extends AbstractCommandHandle
+{
+	public $commandName = 'GeoHash';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $location=array_shift($data);
+
+		$command = [CommandConst::GEOHASH,$key,$location];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoPos.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoPos extends AbstractCommandHandle
+{
+	public $commandName = 'GeoPos';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $location1=array_shift($data);
+
+		$command = [CommandConst::GEOPOS,$key,$location1];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 67 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoRadius.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoRadius extends AbstractCommandHandle
+{
+    public $commandName = 'GeoRadius';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $longitude = array_shift($data);
+        $latitude = array_shift($data);
+        $radius = array_shift($data);
+        $unit = array_shift($data);
+        $withCoord = array_shift($data);
+        $withDist = array_shift($data);
+        $withHash = array_shift($data);
+        $count = array_shift($data);
+        $sort = array_shift($data);
+        $storeKey = array_shift($data);
+        $storeDistKey = array_shift($data);
+
+
+
+        $command = [CommandConst::GEORADIUS, $key, $longitude, $latitude, $radius, $unit,];
+
+        if ($withCoord === true) {
+            $command[] = 'WITHCOORD';
+        }
+        if ($withDist === true) {
+            $command[] = 'WITHDIST';
+        }
+        if ($withHash === true) {
+            $command[] = 'WITHHASH';
+        }
+        if ($count !== null) {
+            $command[] = 'COUNT';
+            $command[] = (int)$count;
+        }
+        if ($sort !== null) {
+            $command[] = $sort;
+        }
+        if ($storeKey !== null) {
+            $command[] = 'STORE';
+            $command[] = $storeKey;
+        }
+        if ($storeDistKey !== null) {
+            $command[] = 'STOREDIST';
+            $command[] = $storeDistKey;
+        }
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 64 - 0
vendor/easyswoole/redis/src/CommandHandle/GeoRadiusByMember.php

@@ -0,0 +1,64 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GeoRadiusByMember extends AbstractCommandHandle
+{
+    public $commandName = 'GeoRadiusByMember';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $location = array_shift($data);
+        $radius = array_shift($data);
+        $unit = array_shift($data);
+        $withCoord = array_shift($data);
+        $withDist = array_shift($data);
+        $withHash = array_shift($data);
+        $count = array_shift($data);
+        $sort = array_shift($data);
+        $storeKey = array_shift($data);
+        $storeDistKey = array_shift($data);
+
+        $command = [CommandConst::GEORADIUSBYMEMBER, $key, $location, $radius, $unit, ];
+
+        if ($withCoord === true) {
+            $command[] = 'WITHCOORD';
+        }
+        if ($withDist === true) {
+            $command[] = 'WITHDIST';
+        }
+        if ($withHash === true) {
+            $command[] = 'WITHHASH';
+        }
+        if ($count !== null) {
+            $command[] = 'COUNT';
+            $command[] = (int)$count;
+        }
+        if ($sort !== null) {
+            $command[] = $sort;
+        }
+        if ($storeKey !== null) {
+            $command[] = 'STORE';
+            $command[] = $storeKey;
+        }
+        if ($storeDistKey !== null) {
+            $command[] = 'STOREDIST';
+            $command[] = $storeDistKey;
+        }
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 25 - 0
vendor/easyswoole/redis/src/CommandHandle/Get.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class Get extends AbstractCommandHandle
+{
+    public $commandName = 'Get';
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $command = [CommandConst::GET, $key];
+        $commandData = $command;
+        return $commandData;
+    }
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+        return $this->unSerialize($data);
+    }
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/GetBit.php

@@ -0,0 +1,32 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GetBit extends AbstractCommandHandle
+{
+	public $commandName = 'GetBit';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $offset=array_shift($data);
+
+
+
+
+		$command = [CommandConst::GETBIT,$key,$offset];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 31 - 0
vendor/easyswoole/redis/src/CommandHandle/GetRange.php

@@ -0,0 +1,31 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GetRange extends AbstractCommandHandle
+{
+	public $commandName = 'GetRange';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $start=array_shift($data);
+		$end=array_shift($data);
+
+
+		$command = [CommandConst::GETRANGE,$key,$start,$end];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/GetSet.php

@@ -0,0 +1,33 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class GetSet extends AbstractCommandHandle
+{
+	public $commandName = 'GetSet';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $value=array_shift($data);
+
+
+		$value = $this->serialize($value);
+
+		$command = [CommandConst::GETSET,$key,$value];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		$data = $recv->getData();
+		        return $this->unSerialize($data);
+	}
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/HDel.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HDel extends AbstractCommandHandle
+{
+	public $commandName = 'HDel';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field=array_shift($data);
+
+		$command = [CommandConst::HDEL,$key,$field];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 32 - 0
vendor/easyswoole/redis/src/CommandHandle/HExists.php

@@ -0,0 +1,32 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HExists extends AbstractCommandHandle
+{
+	public $commandName = 'HExists';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field=array_shift($data);
+
+
+
+
+		$command = [CommandConst::HEXISTS,$key,$field];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 31 - 0
vendor/easyswoole/redis/src/CommandHandle/HGet.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HGet extends AbstractCommandHandle
+{
+    public $commandName = 'HGet';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field = array_shift($data);
+
+        $command = [CommandConst::HGET, $key, $field];
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+        return $this->unSerialize($data);
+    }
+}

+ 35 - 0
vendor/easyswoole/redis/src/CommandHandle/HGetAll.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HGetAll extends AbstractCommandHandle
+{
+    public $commandName = 'HGetAll';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+
+        $command = [CommandConst::HGETALL, $key];
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $result = [];
+        $data = $recv->getData();
+        $dataCount = count($data);
+        for ($i = 0; $i < $dataCount / 2; $i++) {
+            $result[$data[$i * 2]] = $this->unSerialize($data[$i * 2 + 1]);
+        }
+        return $result;
+    }
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/HIncrBy.php

@@ -0,0 +1,33 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HIncrBy extends AbstractCommandHandle
+{
+	public $commandName = 'HIncrBy';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field=array_shift($data);
+		$increment=array_shift($data);
+
+
+
+
+		$command = [CommandConst::HINCRBY,$key,$field,$increment];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/HIncrByFloat.php

@@ -0,0 +1,33 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HIncrByFloat extends AbstractCommandHandle
+{
+	public $commandName = 'HIncrByFloat';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field=array_shift($data);
+		$increment=array_shift($data);
+
+
+
+
+		$command = [CommandConst::HINCRBYFLOAT,$key,$field,$increment];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 29 - 0
vendor/easyswoole/redis/src/CommandHandle/HKeys.php

@@ -0,0 +1,29 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HKeys extends AbstractCommandHandle
+{
+	public $commandName = 'HKeys';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+
+
+		$command = [CommandConst::HKEYS,$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 31 - 0
vendor/easyswoole/redis/src/CommandHandle/HLen.php

@@ -0,0 +1,31 @@
+<?php
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HLen extends AbstractCommandHandle
+{
+	public $commandName = 'HLen';
+
+
+	public function handelCommandData(...$data)
+	{
+		$key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+
+
+
+
+		$command = [CommandConst::HLEN,$key];
+		$commandData = array_merge($command,$data);
+		return $commandData;
+	}
+
+
+	public function handelRecv(Response $recv)
+	{
+		return $recv->getData();
+	}
+}

+ 37 - 0
vendor/easyswoole/redis/src/CommandHandle/HMGet.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HMGet extends AbstractCommandHandle
+{
+    public $commandName = 'HMGet';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $hashKeys = array_shift($data);
+
+        $command = [CommandConst::HMGET, $key];
+        $commandData = array_merge($command, $hashKeys);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $fieldData = array_slice($this->commandData,2);
+        $data = $recv->getData();
+        $array = [];
+        foreach ($data as $key => $value) {
+            $array[$fieldData[$key]] = $this->unSerialize($value);
+        }
+
+        return $array;
+    }
+}

+ 35 - 0
vendor/easyswoole/redis/src/CommandHandle/HMSet.php

@@ -0,0 +1,35 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HMSet extends AbstractCommandHandle
+{
+    public $commandName = 'HMSet';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $data = array_shift($data);
+
+        $kvData = [];
+        foreach ($data as $k => $value) {
+            $kvData[] = $k;
+            $kvData[] = $this->serialize($value);
+        }
+        $command = [CommandConst::HMSET, $key];
+        $commandData = array_merge($command, $kvData);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return true;
+    }
+}

+ 47 - 0
vendor/easyswoole/redis/src/CommandHandle/HScan.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Response;
+
+class HScan extends AbstractCommandHandle
+{
+    public  $commandName = 'HScan';
+
+    public function handelCommandData(...$data)
+    {
+        $key=array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $cursor=array_shift($data);
+        $pattern=array_shift($data);
+        $count=array_shift($data);
+        $command = [CommandConst::HSCAN,$key,$cursor];
+        if ($pattern!==null){
+            $command[] = 'MATCH';
+            $command[] = $pattern;
+        }
+        if ($count!==null){
+            $command[] = 'COUNT';
+            $command[] = $count;
+        }
+        $commandData = $command;
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        $data = $recv->getData();
+        $result = [];
+        foreach ($data[1] as $k=>$value){
+            if ($k%2==0){
+                $result[$value] = [];
+            }else{
+                $result[$data[1][$k-1]]=$this->unSerialize($value);
+            }
+        }
+        $data[1] = $result;
+        return $data;
+    }
+}

+ 33 - 0
vendor/easyswoole/redis/src/CommandHandle/HSet.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace EasySwoole\Redis\CommandHandle;
+
+use EasySwoole\Redis\CommandConst;
+use EasySwoole\Redis\Redis;
+use EasySwoole\Redis\Response;
+
+class HSet extends AbstractCommandHandle
+{
+    public $commandName = 'HSet';
+
+
+    public function handelCommandData(...$data)
+    {
+        $key = array_shift($data);
+        $this->setClusterExecClientByKey($key);
+        $field = array_shift($data);
+        $value = array_shift($data);
+
+        $value = $this->serialize($value);
+
+        $command = [CommandConst::HSET, $key, $field, $value];
+        $commandData = array_merge($command, $data);
+        return $commandData;
+    }
+
+
+    public function handelRecv(Response $recv)
+    {
+        return $recv->getData();
+    }
+}

+ 0 - 0
vendor/easyswoole/redis/src/CommandHandle/HSetNx.php


Неке датотеке нису приказане због велике количине промена