diff --git a/data/dict/redis/redis.json b/data/dict/redis/redis.json index 6ef7e55..6d53660 100644 --- a/data/dict/redis/redis.json +++ b/data/dict/redis/redis.json @@ -1,9 +1,115 @@ { + "version": "4.1.0RC1", + "comment": "php操作Redis客户端", + "constants": [], + "ini": { + "redis.arrays.autorehash": { + "value": "", + "options": [], + "comment": "是否自动重新hash" + }, + "redis.arrays.connecttimeout": { + "value": "", + "options": [], + "comment": "redis数组连接超时时间设置(users=1)" + }, + "redis.arrays.distributor": { + "value": "", + "options": [], + "comment": "redis键分布函数名称或分布方法" + }, + "redis.arrays.functions": { + "value": "", + "options": [], + "comment": "设置每个redis数组使用的函数名称(如:users=user_hash)" + }, + "redis.arrays.hosts": { + "value": "", + "options": [], + "comment": "设置每个数组的主机名(如:users[]=localhost:6379&users[]=localhost:6380&users[]=localhost:6381&users[]=localhost:6382&friends[]=localhost)" + }, + "redis.arrays.index": { + "value": "", + "options": [], + "comment": "设置哪些redis数组使用索引(如:users=1,friends=0)" + }, + "redis.arrays.lazyconnect": { + "value": "", + "options": [], + "comment": "是否在需要操作某个Redis instance上的数据时,才建立连接" + }, + "redis.arrays.names": { + "value": "", + "options": [], + "comment": "可用的redis数组列表(多个使用,隔开,如:users,friends)" + }, + "redis.arrays.pconnect": { + "value": "", + "options": [], + "comment": "redis阵列是否启用长连接" + }, + "redis.arrays.previous": { + "value": "", + "options": [], + "comment": "旧阵列(当一个新的节点添加到一个数组,phpredis需要知道它。节点的旧列表变成“previous”数组,节点的新列表作为主环)" + }, + "redis.arrays.readtimeout": { + "value": "", + "options": [], + "comment": "阵列读数据超时时间" + }, + "redis.arrays.retryinterval": { + "value": "", + "options": [], + "comment": "指定当客户失去与服务器连接时重新连接的延迟的时间" + }, + "redis.clusters.persistent": { + "value": "", + "options": [], + "comment": "集群是否为长连接" + }, + "redis.clusters.read_timeout": { + "value": "", + "options": [], + "comment": "设置集群的读数据超时时间(如:mycluster=10)" + }, + "redis.clusters.seeds": { + "value": "", + "options": [], + "comment": "设置集群对应的主机配置(如:mycluster[]=localhost:7000&test[]=localhost:7001 ;\\n 在程序中使用:$obj_cluster = new RedisCluster('mycluster');)" + }, + "redis.clusters.timeout": { + "value": "", + "options": [], + "comment": "设置集群的连接超时时间(如:mycluster=5)" + }, + "redis.session.locking_enabled": { + "value": "", + "options": [], + "comment": "session是否启用锁" + }, + "redis.session.lock_expire": { + "value": "", + "options": [], + "comment": "设置用redis来存储session数据的锁有效时间" + }, + "redis.session.lock_retries": { + "value": "", + "options": [], + "comment": "设置用redis来存储session数据的锁重试次数" + }, + "redis.session.lock_wait_time": { + "value": "", + "options": [], + "comment": "设置用redis来存储session数据的锁等待时间" + } + }, + "functions": [], "object": { "name": "Redis" }, - "comment": "php操作Redis客户端", "namespace": "", + "interfaces": [], "consts": { "REDIS_NOT_FOUND": { "comment": "未知类型", @@ -62,9 +168,19 @@ }, "OPT_READ_TIMEOUT": { "comment": "读操作超时选项", - "type": "unknown", + "type": "float", "value": 3 }, + "OPT_TCP_KEEPALIVE": { + "comment": "TCP长连接选项", + "type": "int", + "value": 6 + }, + "OPT_COMPRESSION": { + "comment": "启用压缩选项", + "type": "int", + "value": 7 + }, "SERIALIZER_NONE": { "comment": "不实行序列化", "type": "int", @@ -75,6 +191,11 @@ "type": "int", "value": 1 }, + "COMPRESSION_NONE": { + "comment": "", + "type": "int", + "value": 0 + }, "OPT_SCAN": { "comment": "扫描选项", "type": "int", @@ -107,7 +228,7 @@ "access": "public", "comment": "创建一个redis客户端", "isStatic": false, - "return": "Object", + "return": "", "example": "$redis = new Redis();", "parameters": [] }, diff --git a/data/dict/redis/redisarray.json b/data/dict/redis/redisarray.json index 7b3fdc3..25e08d7 100644 --- a/data/dict/redis/redisarray.json +++ b/data/dict/redis/redisarray.json @@ -1 +1,322 @@ -{"object":{"name":"RedisArray"},"comment":"与key相关的redis数组","namespace":"","consts":[],"properties":[],"methods":{"__construct":{"access":"public","comment":"创建一个Redis数组","isStatic":false,"return":"","example":"$ra = new RedisArray(array(\"host1\", \"host2:63792\", \"host2:6380\")); \/\/这里的host1\/host2在php.ini中定义的","parameters":{"hosts":{"comment":"redis节点数组","type":"array","options":[]}}},"__call":{"access":"public","comment":"方法不存在时调用的魔术方法","isStatic":false,"return":"","example":"","parameters":{"function_name":{"comment":"方法名","type":"string","options":[]},"arguments":{"comment":"参数","type":"mixed","options":[]}}},"_hosts":{"access":"public","comment":"返回主机列表","isStatic":false,"return":"array","example":"","parameters":[]},"_target":{"access":"public","comment":"返回指定键分布的节点host","isStatic":false,"return":"string","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"_instance":{"access":"public","comment":"返回连接到指定host的实例","isStatic":false,"return":"","example":"","parameters":{"host":{"comment":"主机","type":"string","options":[]}}},"_function":{"access":"public","comment":"返回键分布使用的函数","isStatic":false,"return":"string","example":"","parameters":[]},"_distributor":{"access":"public","comment":"","isStatic":false,"return":"","example":"","parameters":[]},"_rehash":{"access":"public","comment":"重新对键进行hash分布","isStatic":false,"return":"","example":"","parameters":[]},"select":{"access":"public","comment":"切换数据库","isStatic":false,"return":"bool","example":"\n
\n$redis->select(0);       \/\/ switch to DB 0\n$redis->set('x', '42');  \/\/ write 42 to x\n$redis->move('x', 1);    \/\/ move to DB 1\n$redis->select(1);       \/\/ switch to DB 1\n$redis->get('x');        \/\/ will return 42\n<\/pre>","parameters":{"dbIndex":{"comment":"数据库编号","type":"int","options":[]}}},"info":{"access":"public","comment":"获取Redis服务器的信息和统计数据","isStatic":false,"return":"array","example":"\n
\n$redis->info();\nor\n$redis->info(\"COMMANDSTATS\"); \/\/Information on the commands that have been run (>=2.6 only)\n$redis->info(\"CPU\"); \/\/ just CPU information from Redis INFO\n<\/pre>","parameters":[]},"ping":{"access":"public","comment":"检查当前redis连接状态(成功时返回PONG)","isStatic":false,"return":"string","example":"","parameters":[]},"flushDB":{"access":"public","comment":"删除当前数据库的所有键","isStatic":false,"return":"bool","example":"$redis->flushDB();","parameters":[]},"flushAll":{"access":"public","comment":"删除当前实例的所有键","isStatic":false,"return":"bool","example":"$redis->flushAll();","parameters":[]},"mget":{"access":"public","comment":"批量获取键名","isStatic":false,"return":"","example":"\n
\n$redis->delete('x', 'y', 'z', 'h');\t\/\/ remove x y z\n$redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));\n$redis->hset('h', 'field', 'value');\nvar_dump($redis->mget(array('x', 'y', 'z', 'h')));\n\/\/ Output:\n\/\/ array(3) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ bool(false)\n\/\/ }\n<\/pre>","parameters":{"keys":{"comment":"键名数组","type":"array","options":[]}}},"mset":{"access":"public","comment":"批量设置值","isStatic":false,"return":"bool","example":"\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>","parameters":{"values":{"comment":"要设置的键值对","type":"array","options":[]}}},"del":{"access":"public","comment":"删除一个或多个键","isStatic":false,"return":"int","example":"$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ","parameters":{"keys":{"comment":"键名","type":"array|string","options":[]}}},"getOption":{"access":"public","comment":"获取客户端选项","isStatic":false,"return":"int","example":"\n\/\/ return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY.\n$redis->getOption(Redis::OPT_SERIALIZER);","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]}}},"setOption":{"access":"public","comment":"设置客户端选项.","isStatic":false,"return":"bool:","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        \/\/ don't serialize data\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         \/\/ use built-in serialize\/unserialize\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    \/\/ use igBinary serialize\/unserialize\n$redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      \/\/ use custom prefix on all keys\n<\/pre>","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]},"optionValue":{"comment":"选项值","type":"string","options":[]}}},"keys":{"access":"public","comment":"根据匹配模式获取键名(如*)","isStatic":false,"return":"array","example":"\n$allKeys = $redis->keys('*');\n$keyWithUserPrefix = $redis->keys('user*');","parameters":{"pattern":{"comment":"匹配模式","type":"string","options":[]}}},"save":{"access":"public","comment":"将数据同步到硬盘上","isStatic":false,"return":"boolean","example":"$redis->save();","parameters":[]},"bgSave":{"access":"public","comment":"将数据存入到硬盘上(异步操作)","isStatic":false,"return":"","example":"","parameters":[]},"multi":{"access":"public","comment":"开始一个事务.","isStatic":false,"return":"","example":"\n
\n$ret = $redis->multi()\n->set('key1', 'val1')\n->get('key1')\n->set('key2', 'val2')\n->get('key2')\n->exec();\n\/\/$ret == array (\n\/\/    0 => TRUE,\n\/\/    1 => 'val1',\n\/\/    2 => TRUE,\n\/\/    3 => 'val2');\n<\/pre>","parameters":[]},"discard":{"access":"public","comment":"取消事务","isStatic":false,"return":"","example":"","parameters":[]},"exec":{"access":"public","comment":"执行事务","isStatic":false,"return":"","example":"","parameters":[]},"unwatch":{"access":"public","comment":"取消观察某个键在其他客户端的变化情况","isStatic":false,"return":"","example":"","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"delete":{"access":"public","comment":"删除一个或多个键","isStatic":false,"return":"int","example":"$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ","parameters":{"keys":{"comment":"键名","type":"array|string","options":[]}}},"getMultiple":{"access":"public","comment":"批量获取键值","isStatic":false,"return":"array","example":"\n
\n$redis->set('key1', 'value1');\n$redis->set('key2', 'value2');\n$redis->set('key3', 'value3');\n$redis->getMultiple(array('key1', 'key2', 'key3')); \/\/ array('value1', 'value2', 'value3');\n$redis->getMultiple(array('key0', 'key1', 'key5')); \/\/ array(`FALSE`, 'value2', `FALSE`);\n<\/pre>","parameters":{"keys":{"comment":"键名数组","type":"array","options":[]}}}}}
\ No newline at end of file
+{
+  "object": {
+    "name": "RedisArray"
+  },
+  "comment": "与key相关的redis数组(也有人翻译为redis阵列)",
+  "namespace": "",
+  "interfaces": [],
+  "consts": [],
+  "properties": [],
+  "methods": {
+    "__construct": {
+      "access": "public",
+      "comment": "创建一个Redis数组",
+      "isStatic": false,
+      "return": "",
+      "example": "$ra = new RedisArray(array(\"host1\", \"host2:63792\", \"host2:6380\")); \/\/这里的host1\/host2在php.ini中定义的",
+      "parameters": {
+        "hosts": {
+          "comment": "redis节点数组",
+          "type": "array",
+          "options": []
+        }
+      }
+    },
+    "__call": {
+      "access": "public",
+      "comment": "方法不存在时调用的魔术方法",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": {
+        "function_name": {
+          "comment": "方法名",
+          "type": "string",
+          "options": []
+        },
+        "arguments": {
+          "comment": "参数",
+          "type": "mixed",
+          "options": []
+        }
+      }
+    },
+    "_hosts": {
+      "access": "public",
+      "comment": "返回主机列表",
+      "isStatic": false,
+      "return": "array",
+      "example": "",
+      "parameters": []
+    },
+    "_target": {
+      "access": "public",
+      "comment": "返回指定键分布的节点host",
+      "isStatic": false,
+      "return": "string",
+      "example": "",
+      "parameters": {
+        "key": {
+          "comment": "键名",
+          "type": "string",
+          "options": []
+        }
+      }
+    },
+    "_instance": {
+      "access": "public",
+      "comment": "返回连接到指定host的实例",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": {
+        "host": {
+          "comment": "主机",
+          "type": "string",
+          "options": []
+        }
+      }
+    },
+    "_function": {
+      "access": "public",
+      "comment": "返回键分布使用的函数",
+      "isStatic": false,
+      "return": "string",
+      "example": "",
+      "parameters": []
+    },
+    "_distributor": {
+      "access": "public",
+      "comment": "键分布函数名",
+      "isStatic": false,
+      "return": "string",
+      "example": "",
+      "parameters": []
+    },
+    "_rehash": {
+      "access": "public",
+      "comment": "重新对键进行hash分布",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": []
+    },
+    "select": {
+      "access": "public",
+      "comment": "切换数据库",
+      "isStatic": false,
+      "return": "bool",
+      "example": "\n
\n$redis->select(0);       \/\/ switch to DB 0\n$redis->set('x', '42');  \/\/ write 42 to x\n$redis->move('x', 1);    \/\/ move to DB 1\n$redis->select(1);       \/\/ switch to DB 1\n$redis->get('x');        \/\/ will return 42\n<\/pre>",
+      "parameters": {
+        "dbIndex": {
+          "comment": "数据库编号",
+          "type": "int",
+          "options": []
+        }
+      }
+    },
+    "info": {
+      "access": "public",
+      "comment": "获取Redis服务器的信息和统计数据",
+      "isStatic": false,
+      "return": "array",
+      "example": "\n
\n$redis->info();\nor\n$redis->info(\"COMMANDSTATS\"); \/\/Information on the commands that have been run (>=2.6 only)\n$redis->info(\"CPU\"); \/\/ just CPU information from Redis INFO\n<\/pre>",
+      "parameters": []
+    },
+    "ping": {
+      "access": "public",
+      "comment": "检查当前redis连接状态(成功时返回PONG)",
+      "isStatic": false,
+      "return": "string",
+      "example": "",
+      "parameters": []
+    },
+    "flushDB": {
+      "access": "public",
+      "comment": "删除当前数据库的所有键",
+      "isStatic": false,
+      "return": "bool",
+      "example": "$redis->flushDB();",
+      "parameters": []
+    },
+    "flushAll": {
+      "access": "public",
+      "comment": "删除当前实例的所有键",
+      "isStatic": false,
+      "return": "bool",
+      "example": "$redis->flushAll();",
+      "parameters": []
+    },
+    "mget": {
+      "access": "public",
+      "comment": "批量获取键名",
+      "isStatic": false,
+      "return": "",
+      "example": "\n
\n$redis->delete('x', 'y', 'z', 'h');\t\/\/ remove x y z\n$redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));\n$redis->hset('h', 'field', 'value');\nvar_dump($redis->mget(array('x', 'y', 'z', 'h')));\n\/\/ Output:\n\/\/ array(3) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ bool(false)\n\/\/ }\n<\/pre>",
+      "parameters": {
+        "keys": {
+          "comment": "键名数组",
+          "type": "array",
+          "options": []
+        }
+      }
+    },
+    "mset": {
+      "access": "public",
+      "comment": "批量设置值",
+      "isStatic": false,
+      "return": "bool",
+      "example": "\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>",
+      "parameters": {
+        "values": {
+          "comment": "要设置的键值对",
+          "type": "array",
+          "options": []
+        }
+      }
+    },
+    "del": {
+      "access": "public",
+      "comment": "删除一个或多个键",
+      "isStatic": false,
+      "return": "int",
+      "example": "$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ",
+      "parameters": {
+        "keys": {
+          "comment": "键名",
+          "type": "array|string",
+          "options": []
+        }
+      }
+    },
+    "getOption": {
+      "access": "public",
+      "comment": "获取客户端选项",
+      "isStatic": false,
+      "return": "int",
+      "example": "\n\/\/ return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY.\n$redis->getOption(Redis::OPT_SERIALIZER);",
+      "parameters": {
+        "optionName": {
+          "comment": "选项名",
+          "type": "string",
+          "options": []
+        }
+      }
+    },
+    "setOption": {
+      "access": "public",
+      "comment": "设置客户端选项.",
+      "isStatic": false,
+      "return": "bool:",
+      "example": "\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        \/\/ don't serialize data\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         \/\/ use built-in serialize\/unserialize\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    \/\/ use igBinary serialize\/unserialize\n$redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      \/\/ use custom prefix on all keys\n<\/pre>",
+      "parameters": {
+        "optionName": {
+          "comment": "选项名",
+          "type": "string",
+          "options": []
+        },
+        "optionValue": {
+          "comment": "选项值",
+          "type": "string",
+          "options": []
+        }
+      }
+    },
+    "keys": {
+      "access": "public",
+      "comment": "根据匹配模式获取键名(如*)",
+      "isStatic": false,
+      "return": "array",
+      "example": "\n$allKeys = $redis->keys('*');\n$keyWithUserPrefix = $redis->keys('user*');",
+      "parameters": {
+        "pattern": {
+          "comment": "匹配模式",
+          "type": "string",
+          "options": []
+        }
+      }
+    },
+    "save": {
+      "access": "public",
+      "comment": "将数据同步到硬盘上",
+      "isStatic": false,
+      "return": "boolean",
+      "example": "$redis->save();",
+      "parameters": []
+    },
+    "bgSave": {
+      "access": "public",
+      "comment": "将数据存入到硬盘上(异步操作)",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": []
+    },
+    "multi": {
+      "access": "public",
+      "comment": "开始一个事务.",
+      "isStatic": false,
+      "return": "",
+      "example": "\n
\n$ret = $redis->multi()\n->set('key1', 'val1')\n->get('key1')\n->set('key2', 'val2')\n->get('key2')\n->exec();\n\/\/$ret == array (\n\/\/    0 => TRUE,\n\/\/    1 => 'val1',\n\/\/    2 => TRUE,\n\/\/    3 => 'val2');\n<\/pre>",
+      "parameters": []
+    },
+    "discard": {
+      "access": "public",
+      "comment": "取消事务",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": []
+    },
+    "exec": {
+      "access": "public",
+      "comment": "执行事务",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": []
+    },
+    "unwatch": {
+      "access": "public",
+      "comment": "取消观察某个键在其他客户端的变化情况",
+      "isStatic": false,
+      "return": "",
+      "example": "",
+      "parameters": {
+        "keys": {
+          "comment": "键名",
+          "type": "string|array",
+          "options": []
+        }
+      }
+    },
+    "delete": {
+      "access": "public",
+      "comment": "删除一个或多个键",
+      "isStatic": false,
+      "return": "int",
+      "example": "$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ",
+      "parameters": {
+        "keys": {
+          "comment": "键名",
+          "type": "array|string",
+          "options": []
+        }
+      }
+    },
+    "getMultiple": {
+      "access": "public",
+      "comment": "批量获取键值",
+      "isStatic": false,
+      "return": "array",
+      "example": "\n
\n$redis->set('key1', 'value1');\n$redis->set('key2', 'value2');\n$redis->set('key3', 'value3');\n$redis->getMultiple(array('key1', 'key2', 'key3')); \/\/ array('value1', 'value2', 'value3');\n$redis->getMultiple(array('key0', 'key1', 'key5')); \/\/ array(`FALSE`, 'value2', `FALSE`);\n<\/pre>",
+      "parameters": {
+        "keys": {
+          "comment": "键名数组",
+          "type": "array",
+          "options": []
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/data/dict/redis/rediscluster.json b/data/dict/redis/rediscluster.json
index f3113b1..4e91e60 100644
--- a/data/dict/redis/rediscluster.json
+++ b/data/dict/redis/rediscluster.json
@@ -1 +1 @@
-{"object":{"name":"RedisCluster"},"comment":"redis集群客户端","namespace":"","consts":{"REDIS_NOT_FOUND":{"comment":"未知类型","type":"int","value":0},"REDIS_STRING":{"comment":"字符串类型","type":"int","value":1},"REDIS_SET":{"comment":"集合类型","type":"int","value":2},"REDIS_LIST":{"comment":"列表类型","type":"int","value":3},"REDIS_ZSET":{"comment":"有序集合类型","type":"int","value":4},"REDIS_HASH":{"comment":"字典类型","type":"int","value":5},"ATOMIC":{"comment":"原子操作模式","type":"int","value":0},"MULTI":{"comment":"事务模式","type":"int","value":1},"OPT_SERIALIZER":{"comment":"序列化选项","type":"int","value":1},"OPT_PREFIX":{"comment":"前缀选项","type":"int","value":2},"OPT_READ_TIMEOUT":{"comment":"读操作超时选项","type":"unknown","value":3},"SERIALIZER_NONE":{"comment":"不实行序列化","type":"int","value":0},"SERIALIZER_PHP":{"comment":"PHP序列化","type":"int","value":1},"OPT_SCAN":{"comment":"扫描选项","type":"int","value":4},"SCAN_RETRY":{"comment":"重新扫描","type":"int","value":1},"SCAN_NORETRY":{"comment":"不重新扫描","type":"int","value":0},"OPT_SLAVE_FAILOVER":{"comment":"","type":"unknown","value":5},"FAILOVER_NONE":{"comment":"不使用failover机制","type":"int","value":0},"FAILOVER_ERROR":{"comment":"failover错误","type":"int","value":1},"FAILOVER_DISTRIBUTE":{"comment":"使用分布式failover机制(failover是指一个master有N(N>=1)个slave,当master挂掉以后,能选出一个slave晋升成Master继续提供服务。Failover由失败判定和Leader选举两部分组成,Redis Cluster采用去中心化(Gossip)的设计,每个节点通过发送Ping(包括Gossip信息)\/Pong心跳的方式来探测对方节点的存活,如果心跳超时则标记对方节点的状态为PFail,这个意思是说该节点认为对方节点可能失败了,有可能是网络闪断或者分区等其他原因导致通讯失败)","type":"int","value":2},"AFTER":{"comment":"后面位置","type":"string","value":"after"},"BEFORE":{"comment":"前面位置","type":"string","value":"before"}},"properties":[],"methods":{"__construct":{"access":"public","comment":"创建一个集群对象","isStatic":false,"return":"","example":"$redis = new RedisCluster(null, array('127.0.0.1:6379', '127.0.0.1:6380'));","parameters":{"name":{"comment":"集群名称(在php.ini配置文件或redis.ini配置文件中配置,不配置则为NULL)","type":"string","options":[]},"config":{"comment":"连接的集群节点配置项,如array('127.0.0.1:6379', '127.0.0.1:6380')","type":"array","options":[]},"timeout":{"comment":"连接超时时间","type":"float","options":[]},"read_timeout":{"comment":"读操作超时时间","type":"float","options":[]},"persistent":{"comment":"与每个节点持久化连接","type":"boolean","options":[]}}},"close":{"access":"public","comment":"关闭redis连接(长连接除外)","isStatic":false,"return":"","example":"","parameters":[]},"get":{"access":"public","comment":"获取指定的key的值","isStatic":false,"return":"string|bool","example":"$redis->get('key');","parameters":[]},"set":{"access":"public","comment":"给指定的键设置值","isStatic":false,"return":"bool","example":"直接设置:\n $redis->set('key', 'value');\n带有效期的设置:\n$redis->set('key','value', 10);\n当键不存在时,设置期有效期为10秒:\n$redis->set('key', 'value', Array('nx', 'ex'=>10));\n当键存在时,设置期有效期为1000毫秒:\n$redis->set('key', 'value', Array('xx', 'px'=>1000));\n","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"options":{"comment":"附加项,可以是超时时间或者一个选项数组","type":"int|array","options":[]}}},"mget":{"access":"public","comment":"批量获取键名","isStatic":false,"return":"","example":"\n
\n$redis->delete('x', 'y', 'z', 'h');\t\/\/ remove x y z\n$redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));\n$redis->hset('h', 'field', 'value');\nvar_dump($redis->mget(array('x', 'y', 'z', 'h')));\n\/\/ Output:\n\/\/ array(3) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ bool(false)\n\/\/ }\n<\/pre>","parameters":{"keys":{"comment":"键名数组","type":"array","options":[]}}},"mset":{"access":"public","comment":"批量设置值","isStatic":false,"return":"bool","example":"\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>","parameters":{"values":{"comment":"要设置的键值对","type":"array","options":[]}}},"msetnx":{"access":"public","comment":"批量设置值(当不存在时设置)","isStatic":false,"return":"bool","example":"\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>","parameters":{"values":{"comment":"要设置的键值对","type":"array","options":[]}}},"del":{"access":"public","comment":"删除一个或多个键","isStatic":false,"return":"int","example":"$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ","parameters":{"keys":{"comment":"键名","type":"array|string","options":[]}}},"setex":{"access":"public","comment":"设置键值并设置有效期","isStatic":false,"return":"bool","example":"$redis->setex('key', 3600, 'value');","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"ttl":{"comment":"有效期","type":"int","options":[]}}},"psetex":{"access":"public","comment":"设置键值并设置有效期(毫秒为单位)","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"ttl":{"comment":"有效期(毫秒为单位)","type":"int","options":[]}}},"setnx":{"access":"public","comment":"当键不存在时设置其值","isStatic":false,"return":"bool:","example":"\n$redis->setnx('key', 'value');\n","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]}}},"getset":{"access":"public","comment":"设置键的值,并返回它的旧的缓存值","isStatic":false,"return":"string","example":"\n
\n$redis->set('x', '42');\n$exValue = $redis->getSet('x', 'lol');   \/\/ return '42', replaces x by 'lol'\n$newValue = $redis->get('x')'            \/\/ return 'lol'\n<\/pre>","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]}}},"exists":{"access":"public","comment":"判断键是否存在","isStatic":false,"return":"bool","example":"\n
\n$redis->set('key', 'value');\n$redis->exists('key');               \/\/  TRUE\n$redis->exists('NonExistingKey');    \/\/ FALSE\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"keys":{"access":"public","comment":"根据匹配模式获取键名(如*)","isStatic":false,"return":"array","example":"\n$allKeys = $redis->keys('*');\n$keyWithUserPrefix = $redis->keys('user*');","parameters":{"pattern":{"comment":"匹配模式","type":"string","options":[]}}},"type":{"access":"public","comment":"获取指定键的数据类型(需要根据常量匹配)","isStatic":false,"return":"int","example":"$redis->type('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"lPop":{"access":"public","comment":"从列表左侧删除一个元素","isStatic":false,"return":"string","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->lPop('key1');        \/\/ key1 => [ 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"rPop":{"access":"public","comment":"从列表右侧删除一个元素","isStatic":false,"return":"string","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->rPop('key1');        \/\/ key1 => [ 'A', 'B' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"lset":{"access":"public","comment":"给列表指定位置设置新值","isStatic":false,"return":"boolean","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->lGet('key1', 0);     \/\/ 'A'\n$redis->lSet('key1', 0, 'X');\n$redis->lGet('key1', 0);     \/\/ 'X'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]},"value":{"comment":"新值","type":"string","options":[]}}},"spop":{"access":"public","comment":"随机删除元素的某个或某些成员,并返回这个删除的成员.","isStatic":false,"return":"string | bool","example":"\n
\n$redis->sAdd('key1' , 'set1');\n$redis->sAdd('key1' , 'set2');\n$redis->sAdd('key1' , 'set3');   \/\/ 'key1' => {'set3', 'set1', 'set2'}\n$redis->sPop('key1');            \/\/ 'set1', 'key1' => {'set3', 'set2'}\n$redis->sPop('key1');            \/\/ 'set3', 'key1' => {'set2'}\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"count":{"comment":"删除个数","type":"int","options":[]}}},"lPush":{"access":"public","comment":"从左侧(头部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   \/\/ int(4)\nvar_dump( $redis->lRange('l', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(4) {\n\/\/   [0]=> string(2) \"v4\"\n\/\/   [1]=> string(2) \"v3\"\n\/\/   [2]=> string(2) \"v2\"\n\/\/   [3]=> string(2) \"v1\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"rPush":{"access":"public","comment":"从右侧(尾部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    \/\/ int(4)\nvar_dump( $redis->lRange('l', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(4) {\n\/\/   [0]=> string(2) \"v1\"\n\/\/   [1]=> string(2) \"v2\"\n\/\/   [2]=> string(2) \"v3\"\n\/\/   [3]=> string(2) \"v4\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"blPop":{"access":"public","comment":"是一个阻塞lPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表头部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,blPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。","isStatic":false,"return":"array","example":"\n
\n\/\/ Non blocking feature\n$redis->lPush('key1', 'A');\n$redis->delete('key2');\n$redis->blPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->blPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n$redis->brPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->brPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n\/\/ Blocking feature\n\/\/ process 1\n$redis->delete('key1');\n$redis->blPop('key1', 10);\n\/\/ blocking for 10 seconds\n\/\/ process 2\n$redis->lPush('key1', 'A');\n\/\/ process 1\n\/\/ array('key1', 'A') is returned\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]},"timeout":{"comment":"超时时间","type":"int","options":[]}}},"brPop":{"access":"public","comment":"是一个阻塞rPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表尾部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,brPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。","isStatic":false,"return":"array","example":"\n
\n\/\/ Non blocking feature\n$redis->lPush('key1', 'A');\n$redis->delete('key2');\n$redis->blPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->blPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n$redis->brPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->brPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n\/\/ Blocking feature\n\/\/ process 1\n$redis->delete('key1');\n$redis->blPop('key1', 10);\n\/\/ blocking for 10 seconds\n\/\/ process 2\n$redis->lPush('key1', 'A');\n\/\/ process 1\n\/\/ array('key1', 'A') is returned\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]},"timeout":{"comment":"超时时间","type":"int","options":[]}}},"lPushx":{"access":"public","comment":"如果列表存在,从左侧(头部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->lPushx('key1', 'A');     \/\/ returns 0\n$redis->lPush('key1', 'A');      \/\/ returns 1\n$redis->lPushx('key1', 'B');     \/\/ returns 2\n$redis->lPushx('key1', 'C');     \/\/ returns 3\n\/\/ key1 now points to the following list: [ 'A', 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"rPushx":{"access":"public","comment":"如果列表存在,从右侧(尾部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->rPushx('key1', 'A'); \/\/ returns 0\n$redis->rPush('key1', 'A'); \/\/ returns 1\n$redis->rPushx('key1', 'B'); \/\/ returns 2\n$redis->rPushx('key1', 'C'); \/\/ returns 3\n\/\/ key1 now points to the following list: [ 'A', 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"linsert":{"access":"public","comment":"在列表中,在某个元素的前面或后面插入一个新值","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->lInsert('key1', Redis::AFTER, 'A', 'X');     \/\/ 0\n$redis->lPush('key1', 'A');\n$redis->lPush('key1', 'B');\n$redis->lPush('key1', 'C');\n$redis->lInsert('key1', Redis::BEFORE, 'C', 'X');    \/\/ 4\n$redis->lRange('key1', 0, -1);                       \/\/ array('A', 'B', 'X', 'C')\n$redis->lInsert('key1', Redis::AFTER, 'C', 'Y');     \/\/ 5\n$redis->lRange('key1', 0, -1);                       \/\/ array('A', 'B', 'X', 'C', 'Y')\n$redis->lInsert('key1', Redis::AFTER, 'W', 'value'); \/\/ -1\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"position":{"comment":"位置(前面或后面,使用Redis::BEFORE | Redis::AFTER)","type":"string","options":[]},"element":{"comment":"元素","type":"string","options":[]},"value":{"comment":"新值","type":"string","options":[]}}},"lindex":{"access":"public","comment":"获取列表中指定索引的值","isStatic":false,"return":"string | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]}}},"lrem":{"access":"public","comment":"从列表中删除指定值的元素。 如果count为零,则删除所有匹配的元素。 如果计数是负数,则元素从尾部移到头部。","isStatic":false,"return":"long | bool","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]},"count":{"comment":"删除的个数","type":"int","options":[]}}},"rpoplpush":{"access":"public","comment":"从一个队列的队尾删除一个元素,并将该元素插入到另一个队列的头部","isStatic":false,"return":"string","example":"\n
\n$redis->delete('x', 'y');\n$redis->lPush('x', 'abc');\n$redis->lPush('x', 'def');\n$redis->lPush('y', '123');\n$redis->lPush('y', '456');\n\/\/ move the last of x to the front of y.\nvar_dump($redis->rpoplpush('x', 'y'));\nvar_dump($redis->lRange('x', 0, -1));\nvar_dump($redis->lRange('y', 0, -1));\n\/\/Output:\n\/\/\n\/\/string(3) \"abc\"\n\/\/array(1) {\n\/\/  [0]=>\n\/\/  string(3) \"def\"\n\/\/}\n\/\/array(3) {\n\/\/  [0]=>\n\/\/  string(3) \"abc\"\n\/\/  [1]=>\n\/\/  string(3) \"456\"\n\/\/  [2]=>\n\/\/  string(3) \"123\"\n\/\/}\n<\/pre>","parameters":{"srcKey":{"comment":"要删除元素的队列键名","type":"string","options":[]},"dstKey":{"comment":"要插入元素的队列的键名","type":"string","options":[]}}},"brpoplpush":{"access":"public","comment":"阻塞执行rpoplpush","isStatic":false,"return":"string","example":"","parameters":{"srcKey":{"comment":"要删除元素的队列键名","type":"string","options":[]},"dstKey":{"comment":"要插入元素的队列的键名","type":"string","options":[]}}},"llen":{"access":"public","comment":"返回列表的长度","isStatic":false,"return":"long | bool","example":"","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]}}},"scard":{"access":"public","comment":"返回集合的元素个数","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"smembers":{"access":"public","comment":"返回集合的所有成员","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s');\n$redis->sAdd('s', 'a');\n$redis->sAdd('s', 'b');\n$redis->sAdd('s', 'a');\n$redis->sAdd('s', 'c');\nvar_dump($redis->sMembers('s'));\n\/\/array(3) {\n\/\/  [0]=>\n\/\/  string(1) \"c\"\n\/\/  [1]=>\n\/\/  string(1) \"a\"\n\/\/  [2]=>\n\/\/  string(1) \"b\"\n\/\/}\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"sismember":{"access":"public","comment":"是否包含某个成员","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"sAdd":{"access":"public","comment":"给集合添加元素","isStatic":false,"return":"int","example":"\n
\n$redis->sAdd('k', 'v1');                \/\/ int(1)\n$redis->sAdd('k', 'v1', 'v2', 'v3');    \/\/ int(2)\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"sAddArray":{"access":"public","comment":"给集合批量添加元素","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"array","options":[]}}},"srem":{"access":"public","comment":"删除集合元素","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"member":{"comment":"成员","type":"string|...","options":[]}}},"sUnion":{"access":"public","comment":"获取集合的并集","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s1', '3');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\n$redis->sAdd('s2', '4');\nvar_dump($redis->sUnion('s0', 's1', 's2'));\narray(4) {\n\/\/  [0]=>\n\/\/  string(1) \"3\"\n\/\/  [1]=>\n\/\/  string(1) \"4\"\n\/\/  [2]=>\n\/\/  string(1) \"1\"\n\/\/  [3]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string|...","options":[]}}},"sUnionStore":{"access":"public","comment":"获取多个集合的并集,并将结果存入到另外一个集合中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s1', '3');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\n$redis->sAdd('s2', '4');\nvar_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));\nvar_dump($redis->sMembers('dst'));\n\/\/int(4)\n\/\/array(4) {\n\/\/  [0]=>\n\/\/  string(1) \"3\"\n\/\/  [1]=>\n\/\/  string(1) \"4\"\n\/\/  [2]=>\n\/\/  string(1) \"1\"\n\/\/  [3]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"sInter":{"access":"public","comment":"获取两个集合的交集","isStatic":false,"return":"array | boolean","example":"\n
\n$redis->sAdd('key1', 'val1');\n$redis->sAdd('key1', 'val2');\n$redis->sAdd('key1', 'val3');\n$redis->sAdd('key1', 'val4');\n$redis->sAdd('key2', 'val3');\n$redis->sAdd('key2', 'val4');\n$redis->sAdd('key3', 'val3');\n$redis->sAdd('key3', 'val4');\nvar_dump($redis->sInter('key1', 'key2', 'key3'));\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(4) \"val4\"\n\/\/  [1]=>\n\/\/  string(4) \"val3\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]}}},"sInterStore":{"access":"public","comment":"获取多个集合的交集,并将结果存入到另外一个集合中","isStatic":false,"return":"int","example":"\n
\n$redis->sAdd('key1', 'val1');\n$redis->sAdd('key1', 'val2');\n$redis->sAdd('key1', 'val3');\n$redis->sAdd('key1', 'val4');\n$redis->sAdd('key2', 'val3');\n$redis->sAdd('key2', 'val4');\n$redis->sAdd('key3', 'val3');\n$redis->sAdd('key3', 'val4');\nvar_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));\nvar_dump($redis->sMembers('output'));\n\/\/int(2)\n\/\/\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(4) \"val4\"\n\/\/  [1]=>\n\/\/  string(4) \"val3\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"sDiff":{"access":"public","comment":"获取多个集合的差集","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s0', '3');\n$redis->sAdd('s0', '4');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\nvar_dump($redis->sDiff('s0', 's1', 's2'));\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(1) \"4\"\n\/\/  [1]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string|...","options":[]}}},"sDiffStore":{"access":"public","comment":"获取多个集合的差集,并将结果存入到一个新的集合中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s0', '3');\n$redis->sAdd('s0', '4');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\nvar_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));\nvar_dump($redis->sMembers('dst'));\n\/\/int(2)\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(1) \"4\"\n\/\/  [1]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"srandmember":{"access":"public","comment":"随机返回一个集合的元素(不会删除它)","isStatic":false,"return":"string | bool","example":"\n
\n$redis->sAdd('key1' , 'one');\n$redis->sAdd('key1' , 'two');\n$redis->sAdd('key1' , 'three');              \/\/ 'key1' => {'one', 'two', 'three'}\nvar_dump( $redis->sRandMember('key1') );     \/\/ 'key1' => {'one', 'two', 'three'}\n\/\/ string(5) \"three\"\nvar_dump( $redis->sRandMember('key1', 2) );  \/\/ 'key1' => {'one', 'two', 'three'}\n\/\/ array(2) {\n\/\/   [0]=> string(2) \"one\"\n\/\/   [1]=> string(2) \"three\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"strlen":{"access":"public","comment":"获取键值的长度","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', 'value');\n$redis->strlen('key'); \/\/ 5\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"persist":{"access":"public","comment":"移除指定键的有效期,让它永久有效","isStatic":false,"return":"bool:","example":"$redis->persist('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"ttl":{"access":"public","comment":"返回指定键的有效时间(秒)","isStatic":false,"return":"long","example":"$redis->ttl('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"pttl":{"access":"public","comment":"返回指定键的有效时间(毫秒)","isStatic":false,"return":"long","example":"$redis->pttl('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"zcard":{"access":"public","comment":"获取有序集合的成员数","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zCard('key');            \/\/ 3\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]}}},"zcount":{"access":"public","comment":"获取指定排序范围的成员数.","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zCount('key', 0, 3); \/\/ 2, corresponding to array('val0', 'val2')\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"zremrangebyscore":{"access":"public","comment":"根据排序值范围来删除成员","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"zscore":{"access":"public","comment":"获取指定成员的排序值(分数)","isStatic":false,"return":"double","example":"\n
\n$redis->zAdd('key', 2.5, 'val2');\n$redis->zScore('key', 'val2'); \/\/ 2.5\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"zadd":{"access":"public","comment":"向有序集合插入元素","isStatic":false,"return":"int","example":"\n
\n
\n$redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  \/\/ int(2)\n$redis->zRem('z', 'v2', 'v3');                           \/\/ int(2)\nvar_dump( $redis->zRange('z', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(2) {\n\/\/   [0]=> string(2) \"v1\"\n\/\/   [1]=> string(2) \"v4\"\n\/\/ }\n<\/pre>\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"score":{"comment":"排序值","type":"double","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"zincrby":{"access":"public","comment":"给有序集合成员增加排序值","isStatic":false,"return":"float","example":"\n
\n$redis->delete('key');\n$redis->zIncrBy('key', 2.5, 'member1');  \/\/ key or member1 didn't exist, so member1's score is to 0\n\/\/ before the increment and now has the value 2.5\n$redis->zIncrBy('key', 1, 'member1');    \/\/ 3.5\n<\/pre>","parameters":{"key":{"comment":"目标集合键名","type":"string","options":[]},"step":{"comment":"增加的步长","type":"double","options":[]},"member":{"comment":"成员","type":"string","options":[]}}},"hGet":{"access":"public","comment":"获取字典的某个字段的值","isStatic":false,"return":"string","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]}}},"hSet":{"access":"public","comment":"为字典的字段设置值","isStatic":false,"return":"long","example":"\n
\n$redis->delete('h')\n$redis->hSet('h', 'key1', 'hello');  \/\/ 1, 'key1' => 'hello' in the hash at \"h\"\n$redis->hGet('h', 'key1');           \/\/ returns \"hello\"\n$redis->hSet('h', 'key1', 'plop');   \/\/ 0, value was replaced.\n$redis->hGet('h', 'key1');           \/\/ returns \"plop\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"value":{"comment":"字段值","type":"string","options":[]}}},"hSetNx":{"access":"public","comment":"当字典的字段不存在时,为其设置值","isStatic":false,"return":"bool","example":"\n
\n$redis->delete('h')\n$redis->hSetNx('h', 'key1', 'hello'); \/\/ TRUE, 'key1' => 'hello' in the hash at \"h\"\n$redis->hSetNx('h', 'key1', 'world'); \/\/ FALSE, 'key1' => 'hello' in the hash at \"h\". No change since the field\nwasn't replaced.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"value":{"comment":"字段值","type":"string","options":[]}}},"hDel":{"access":"public","comment":"删除字典的某个或某些字段","isStatic":false,"return":"int","example":"\n
\n$redis->hMSet('h',\narray(\n'f1' => 'v1',\n'f2' => 'v2',\n'f3' => 'v3',\n'f4' => 'v4',\n));\nvar_dump( $redis->hDel('h', 'f1') );        \/\/ int(1)\nvar_dump( $redis->hDel('h', 'f2', 'f3') );  \/\/ int(2)\ns\nvar_dump( $redis->hGetAll('h') );\n\/\/\/\/ Output:\n\/\/  array(1) {\n\/\/    [\"f4\"]=> string(2) \"v4\"\n\/\/  }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段名","type":"string|array","options":[]}}},"hLen":{"access":"public","comment":"获取字典的字段个数","isStatic":false,"return":"int","example":"\n
\n$redis->delete('h')\n$redis->hSet('h', 'key1', 'hello');\n$redis->hSet('h', 'key2', 'plop');\n$redis->hLen('h'); \/\/ returns 2\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hKeys":{"access":"public","comment":"获取字典的字段名称列表.","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hKeys('h'));\n\/\/ Output:\n\/\/ array(4) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ string(1) \"d\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hVals":{"access":"public","comment":"获取字典的字段值列表","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hVals('h'));\n\/\/ Output\n\/\/ array(4) {\n\/\/   [0]=>\n\/\/   string(1) \"x\"\n\/\/   [1]=>\n\/\/   string(1) \"y\"\n\/\/   [2]=>\n\/\/   string(1) \"z\"\n\/\/   [3]=>\n\/\/   string(1) \"t\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hGetAll":{"access":"public","comment":"获取字典所有字段键值对","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hGetAll('h'));\n\/\/ Output:\n\/\/ array(4) {\n\/\/   [\"a\"]=>\n\/\/   string(1) \"x\"\n\/\/   [\"b\"]=>\n\/\/   string(1) \"y\"\n\/\/   [\"c\"]=>\n\/\/   string(1) \"z\"\n\/\/   [\"d\"]=>\n\/\/   string(1) \"t\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hExists":{"access":"public","comment":"判断字典的某个字段是否存在.","isStatic":false,"return":"bool","example":"\n
\n$redis->hSet('h', 'a', 'x');\n$redis->hExists('h', 'a');               \/\/  TRUE\n$redis->hExists('h', 'NonExistingKey');  \/\/ FALSE\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]}}},"hIncrBy":{"access":"public","comment":"为指定字段增加指定的值.","isStatic":false,"return":"int","example":"\n
\n$redis->delete('h');\n$redis->hIncrBy('h', 'x', 2); \/\/ returns 2: h[x] = 2 now.\n$redis->hIncrBy('h', 'x', 1); \/\/ h[x] ← 2 + 1. Returns 3\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"step":{"comment":"自增步长","type":"int","options":[]}}},"hIncrByFloat":{"access":"public","comment":"为指定字段增加指定的值","isStatic":false,"return":"","example":"\n
\n$redis = new Redis();\n$redis->connect('127.0.0.1');\n$redis->hset('h', 'float', 3);\n$redis->hset('h', 'int',   3);\nvar_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); \/\/ float(4.5)\nvar_dump( $redis->hGetAll('h') );\n\/\/ Output\narray(2) {\n[\"float\"]=>\nstring(3) \"4.5\"\n[\"int\"]=>\nstring(1) \"3\"\n}\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"step":{"comment":"自增步长","type":"double","options":[]}}},"hMset":{"access":"public","comment":"批量设置字典字段的值","isStatic":false,"return":"boolean","example":"\n
\n$redis->delete('user:1');\n$redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));\n$redis->hIncrBy('user:1', 'salary', 100); \/\/ Joe earns 100 more now.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段键值对","type":"array","options":[]}}},"hMget":{"access":"public","comment":"批量获取字典的字段值","isStatic":false,"return":"array","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段名列表","type":"array","options":[]}}},"dump":{"access":"public","comment":"将某个键导出为一个二进制数据.","isStatic":false,"return":"string","example":"\n
\n$redis->set('foo', 'bar');\n$val = $redis->dump('foo'); \/\/ $val will be the Redis encoded key value\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"zRank":{"access":"public","comment":"获取成员的排序值","isStatic":false,"return":"int","example":"\n
\n$redis->delete('z');\n$redis->zAdd('key', 1, 'one');\n$redis->zAdd('key', 2, 'two');\n$redis->zRank('key', 'one');     \/\/ 0\n$redis->zRank('key', 'two');     \/\/ 1\n$redis->zRevRank('key', 'one');  \/\/ 1\n$redis->zRevRank('key', 'two');  \/\/ 0\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"zRevRank":{"access":"public","comment":"获取成员的排位值(倒数)","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"incr":{"access":"public","comment":"键值自增","isStatic":false,"return":"int","example":"\n
\n$redis->incr('key1'); \/\/ key1 didn't exists, set to 0 before the increment and now has the value 1\n$redis->incr('key1'); \/\/ 2\n$redis->incr('key1'); \/\/ 3\n$redis->incr('key1'); \/\/ 4\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"incrBy":{"access":"public","comment":"按指定步长自增","isStatic":false,"return":"int","example":"\n
\n$redis->incr('key1');        \/\/ key1 didn't exists, set to 0 before the increment and now has the value 1\n$redis->incr('key1');        \/\/ 2\n$redis->incr('key1');        \/\/ 3\n$redis->incr('key1');        \/\/ 4\n$redis->incrBy('key1', 10);  \/\/ 14\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自增步长","type":"int","options":[]}}},"incrByFloat":{"access":"public","comment":"按指定步长自增","isStatic":false,"return":"float","example":"\n
\n$redis = new Redis();\n$redis->connect('127.0.0.1');\n$redis->set('x', 3);\nvar_dump( $redis->incrByFloat('x', 1.5) );   \/\/ float(4.5)\n\/\/ ! SIC\nvar_dump( $redis->get('x') );                \/\/ string(3) \"4.5\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自增步长","type":"float","options":[]}}},"decr":{"access":"public","comment":"键值自减","isStatic":false,"return":"int","example":"\n
\n$redis->decr('key1'); \/\/ key1 didn't exists, set to 0 before the increment and now has the value -1\n$redis->decr('key1'); \/\/ -2\n$redis->decr('key1'); \/\/ -3\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"decrBy":{"access":"public","comment":"按指定步长自减","isStatic":false,"return":"int","example":"\n
\n$redis->decr('key1');        \/\/ key1 didn't exists, set to 0 before the increment and now has the value -1\n$redis->decr('key1');        \/\/ -2\n$redis->decr('key1');        \/\/ -3\n$redis->decrBy('key1', 10);  \/\/ -13\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自减步长","type":"float","options":[]}}},"expire":{"access":"public","comment":"设置键的有效期","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期(秒数)","type":"int","options":[]}}},"expireAt":{"access":"public","comment":"为某个键设置有效期为某个时间点","isStatic":false,"return":"bool:","example":"\n
\n$redis->set('x', '42');\n$now = time(NULL);               \/\/ current timestamp\n$redis->expireAt('x', $now + 3); \/\/ x will disappear in 3 seconds.\nsleep(5);                        \/\/ wait 5 seconds\n$redis->get('x');                \/\/ will return `FALSE`, as 'x' has expired.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"expireTime":{"comment":"到期时间","type":"int","options":[]}}},"pexpire":{"access":"public","comment":"设置键的有效期(毫秒为单位)","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期(毫秒数)","type":"int","options":[]}}},"pexpireAt":{"access":"public","comment":"为某个键设置有效期为某个时间点(精确到毫秒)","isStatic":false,"return":"bool:","example":"\n
\n$redis->set('x', '42');\n$now = time(NULL);               \/\/ current timestamp\n$redis->expireAt('x', $now + 3); \/\/ x will disappear in 3 seconds.\nsleep(5);                        \/\/ wait 5 seconds\n$redis->get('x');                \/\/ will return `FALSE`, as 'x' has expired.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"expireTime":{"comment":"到期时间","type":"int","options":[]}}},"append":{"access":"public","comment":"将字符串追加到键值后(返回值的长度)","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', 'value1');\n$redis->append('key', 'value2'); \/\/ 12\n$redis->get('key');              \/\/ 'value1value2'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"追加的值","type":"string","options":[]}}},"getBit":{"access":"public","comment":"获取某个键的某个位置的位值","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', \"\\x7f\");  \/\/ this is 0111 1111\n$redis->getBit('key', 0);    \/\/ 0\n$redis->getBit('key', 1);    \/\/ 1\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"所在位置","type":"int","options":[]}}},"setBit":{"access":"public","comment":"修改某个键的某个位置的位值","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', \"*\");     \/\/ ord(\"*\") = 42 = 0x2f = \"0010 1010\"\n$redis->setBit('key', 5, 1); \/\/ returns 0\n$redis->setBit('key', 7, 1); \/\/ returns 0\n$redis->get('key');          \/\/ chr(0x2f) = \"\/\" = b(\"0010 1111\")\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"开始位置","type":"int","options":[]},"value":{"comment":"新值","type":"boolean|int","options":[]}}},"bitop":{"access":"public","comment":"多个键的位操作,并将结果存入到指定的键中","isStatic":false,"return":"long","example":"","parameters":{"operation":{"comment":"操作(有 AND, OR, NOT, XOR 4种可选择)","type":"string","options":[]},"dstKey":{"comment":"目标键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名N","type":"string|...","options":[]}}},"bitcount":{"access":"public","comment":"统计字符串的位数","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"bitpos":{"access":"public","comment":"获取指定位置的位值","isStatic":false,"return":"function","example":"\n
\n$redis->set('key', '\\xff\\xff');\n$redis->bitpos('key', 1); \/\/ int(0)\n$redis->bitpos('key', 1, 1); \/\/ int(8)\n$redis->bitpos('key', 1, 3); \/\/ int(-1)\n$redis->bitpos('key', 0); \/\/ int(16)\n$redis->bitpos('key', 0, 1); \/\/ int(16)\n$redis->bitpos('key', 0, 1, 5); \/\/ int(-1)\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"bit":{"comment":"位值","type":"int","options":[]},"start":{"comment":"开始位置","type":"int","options":[]},"end":{"comment":"结束位置","type":"int","options":[]}}},"lget":{"access":"public","comment":"获取列表中指定索引的值","isStatic":false,"return":"string | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]}}},"getrange":{"access":"public","comment":"获取一个键值的子字符串","isStatic":false,"return":"string:","example":"\n
\n$redis->set('key', 'string value');\n$redis->getRange('key', 0, 5);   \/\/ 'string'\n$redis->getRange('key', -5, -1); \/\/ 'value'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"开始位置","type":"int","options":[]},"end":{"comment":"结束位置","type":"int","options":[]}}},"ltrim":{"access":"public","comment":"删除指定范围外的其他元素","isStatic":false,"return":"array | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"开始索引","type":"int","options":[]},"end":{"comment":"结束索引","type":"int","options":[]}}},"lrange":{"access":"public","comment":"获取列表指定范围的值","isStatic":false,"return":"array","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"int","options":[]},"end":{"comment":"索引结束值","type":"int","options":[]}}},"zremrangebyrank":{"access":"public","comment":"根据排序范围删除成员","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 1, 'one');\n$redis->zAdd('key', 2, 'two');\n$redis->zAdd('key', 3, 'three');\n$redis->zRemRangeByRank('key', 0, 1); \/\/ 2\n$redis->zRange('key', 0, -1, array('withscores' => TRUE)); \/\/ array('three' => 3)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"publish":{"access":"public","comment":"将消息发布到消息通道(队列).","isStatic":false,"return":"int","example":"$redis->publish('chan-1', 'hello, world!'); \/\/ send message.","parameters":{"channel":{"comment":"消息频道","type":"string","options":[]},"message":{"comment":"消息","type":"string","options":[]}}},"rename":{"access":"public","comment":"给键重命名","isStatic":false,"return":"boolean","example":"","parameters":{"srcKey":{"comment":"旧键名","type":"string","options":[]},"dstKey":{"comment":"新键名","type":"string","options":[]}}},"renamenx":{"access":"public","comment":"当目标键名不存在时,给键重命名","isStatic":false,"return":"boolean","example":"","parameters":{"srcKey":{"comment":"旧键名","type":"string","options":[]},"dstKey":{"comment":"新键名","type":"string","options":[]}}},"pfadd":{"access":"public","comment":"将所有元素参数添加到 HyperLogLog 数据结构中","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"element":{"comment":"元素","type":"string|array|...","options":[]}}},"pfcount":{"access":"public","comment":"返回给定 HyperLogLog 的基数估算值","isStatic":false,"return":"","example":"","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"pfmerge":{"access":"public","comment":"将多个 HyperLogLog 合并为一个 HyperLogLog ,合并后的 HyperLogLog 的基数估算值是通过对所有 给定 HyperLogLog 进行并集计算得出的","isStatic":false,"return":"","example":"","parameters":{"dstKey":{"comment":"目标键名","type":"string|array","options":[]},"sourceKeys":{"comment":"源键名","type":"string|array","options":[]}}},"setrange":{"access":"public","comment":"修改某个键的某个位置的值","isStatic":false,"return":"string","example":"\n
\n$redis->set('key', 'Hello world');\n$redis->setRange('key', 6, \"redis\"); \/\/ returns 11\n$redis->get('key');                  \/\/ \"Hello redis\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"开始位置","type":"int","options":[]},"value":{"comment":"被替换的子串的值","type":"string","options":[]}}},"restore":{"access":"public","comment":"将dump导出的二进制数据恢复到可读的字符串.","isStatic":false,"return":"","example":"\n
\n$redis->set('foo', 'bar');\n$val = $redis->dump('foo');\n$redis->restore('bar', 0, $val); \/\/ The key 'bar', will now be equal to the key 'foo'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期","type":"int","options":[]},"value":{"comment":"dump导出的二进制数据","type":"string","options":[]}}},"smove":{"access":"public","comment":"将某个集合中的元素移动到另外一个集合中","isStatic":false,"return":"bool","example":"\n
\n$redis->sAdd('key1' , 'set11');\n$redis->sAdd('key1' , 'set12');\n$redis->sAdd('key1' , 'set13');          \/\/ 'key1' => {'set11', 'set12', 'set13'}\n$redis->sAdd('key2' , 'set21');\n$redis->sAdd('key2' , 'set22');          \/\/ 'key2' => {'set21', 'set22'}\n$redis->sMove('key1', 'key2', 'set13');  \/\/ 'key1' =>  {'set11', 'set12'}\n\/\/ 'key2' =>  {'set21', 'set22', 'set13'}\n<\/pre>","parameters":{"srcKey":{"comment":"原集合键名","type":"string","options":[]},"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"member":{"comment":"成员","type":"string","options":[]}}},"zRange":{"access":"public","comment":"获取有序集合中指定范围的成员","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key1', 0, 'val0');\n$redis->zAdd('key1', 2, 'val2');\n$redis->zAdd('key1', 10, 'val10');\n$redis->zRange('key1', 0, -1); \/\/ array('val0', 'val2', 'val10')\n\/\/ with scores\n$redis->zRange('key1', 0, -1, true); \/\/ array('val0' => 0, 'val2' => 2, 'val10' => 10)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"withScores":{"comment":"是否返回成员的排序值","type":"boolean","options":[]}}},"zRevRange":{"access":"public","comment":"获取有序集合中指定范围的成员(倒序排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRevRange('key', 0, -1); \/\/ array('val10', 'val2', 'val0')\n\/\/ with scores\n$redis->zRevRange('key', 0, -1, true); \/\/ array('val10' => 10, 'val2' => 2, 'val0' => 0)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"withScores":{"comment":"是否返回成员的排序值","type":"boolean","options":[]}}},"zRangeByScore":{"access":"public","comment":"获取有序集合中指定范围的成员(按排序值排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRangeByScore('key', 0, 3);                                          \/\/ array('val0', 'val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              \/\/ array('val0' => 0, 'val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  \/\/ array('val2' => 2)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"options":{"comment":"附加选项(可以是:withscores => TRUE, and limit => array($offset, $count))","type":"array","options":[]}}},"zRevRangeByScore":{"access":"public","comment":"获取有序集合中指定范围的成员(按排序值倒序排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRangeByScore('key', 0, 3);                                          \/\/ array('val0', 'val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              \/\/ array('val0' => 0, 'val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  \/\/ array('val2' => 2)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"options":{"comment":"附加选项(可以是:withscores => TRUE, and limit => array($offset, $count))","type":"array","options":[]}}},"zRangeByLex":{"access":"public","comment":"按字母字典的顺序返回成员","isStatic":false,"return":"array","example":"\n
\nforeach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {\n$redis->zAdd('key', $char);\n}\n$redis->zRangeByLex('key', '-', '[c'); \/\/ array('a', 'b', 'c')\n$redis->zRangeByLex('key', '-', '(c'); \/\/ array('a', 'b')\n$redis->zRangeByLex('key', '-', '[c'); \/\/ array('b', 'c')\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]},"offset":{"comment":"索引开始值","type":"long","options":[]},"limit":{"comment":"成员数","type":"long","options":[]}}},"zRevRangeByLex":{"access":"public","comment":"按字母字典的顺序返回成员(倒序排序)","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]},"offset":{"comment":"索引开始值","type":"long","options":[]},"limit":{"comment":"成员数","type":"long","options":[]}}},"zlexcount":{"access":"public","comment":"获取指定字母范围的成员数","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]}}},"zremrangebylex":{"access":"public","comment":"删除指定字母范围的成员","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]}}},"zunionstore":{"access":"public","comment":"将两个有序集合的并集存入到一个指定的键中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('k1');\n$redis->delete('k2');\n$redis->delete('k3');\n$redis->delete('ko1');\n$redis->delete('ko2');\n$redis->delete('ko3');\n$redis->zAdd('k1', 0, 'val0');\n$redis->zAdd('k1', 1, 'val1');\n$redis->zAdd('k2', 2, 'val2');\n$redis->zAdd('k2', 3, 'val3');\n$redis->zUnion('ko1', array('k1', 'k2')); \/\/ 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')\n\/\/ Weighted zUnion\n$redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); \/\/ 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')\n$redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); \/\/ 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')\n<\/pre>","parameters":{"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"zsetKeys":{"comment":"集合键名","type":"array","options":[]},"zsetKeysWeight":{"comment":"集合键对应的权重","type":"array","options":[]},"aggregateFunction":{"comment":"合并使用的函数(SUM, MIN, 或 MAX)","type":"string","options":[]}}},"zinterstore":{"access":"public","comment":"将两个有序集合的交集存入到一个指定的键中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('k1');\n$redis->delete('k2');\n$redis->delete('k3');\n$redis->delete('ko1');\n$redis->delete('ko2');\n$redis->delete('ko3');\n$redis->delete('ko4');\n$redis->zAdd('k1', 0, 'val0');\n$redis->zAdd('k1', 1, 'val1');\n$redis->zAdd('k1', 3, 'val3');\n$redis->zAdd('k2', 2, 'val1');\n$redis->zAdd('k2', 3, 'val3');\n$redis->zInter('ko1', array('k1', 'k2'));               \/\/ 2, 'ko1' => array('val1', 'val3')\n$redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  \/\/ 2, 'ko2' => array('val1', 'val3')\n\/\/ Weighted zInter\n$redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); \/\/ 2, 'ko3' => array('val1', 'val3')\n$redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); \/\/ 2, 'ko4' => array('val3', 'val1')\n<\/pre>","parameters":{"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"zsetKeys":{"comment":"集合键名","type":"array","options":[]},"zsetKeysWeight":{"comment":"集合键对应的权重","type":"array","options":[]},"aggregateFunction":{"comment":"合并使用的函数(SUM, MIN, 或 MAX)","type":"string","options":[]}}},"zrem":{"access":"public","comment":"删除有序集合中的某个成员","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"sort":{"access":"public","comment":"给列表、集合或有序集合的元素排序","isStatic":false,"return":"An","example":"\n
\n$redis->delete('s');\n$redis->sadd('s', 5);\n$redis->sadd('s', 4);\n$redis->sadd('s', 2);\n$redis->sadd('s', 1);\n$redis->sadd('s', 3);\nvar_dump($redis->sort('s')); \/\/ 1,2,3,4,5\nvar_dump($redis->sort('s', array('sort' => 'desc'))); \/\/ 5,4,3,2,1\nvar_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); \/\/ (int)5\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"options":{"comment":"排序参数,如:array('sort' => 'desc')","type":"array","options":[]}}},"object":{"access":"public","comment":"获取某个键的对象信息","isStatic":false,"return":"string","example":"\n
\n$redis->object(\"encoding\", \"l\"); \/\/ → ziplist\n$redis->object(\"refcount\", \"l\"); \/\/ → 1\n$redis->object(\"idletime\", \"l\"); \/\/ → 400 (in seconds, with a precision of 10 seconds).\n<\/pre>","parameters":{"info":{"comment":"获取的信息指标名称(有 encoding、refcount 、idletime 3种可选择)","type":"string","options":[]},"key":{"comment":"键名","type":"string","options":[]}}},"subscribe":{"access":"public","comment":"订阅消息","isStatic":false,"return":"mixed","example":"\n
\nfunction f($redis, $chan, $msg) {\nswitch($chan) {\ncase 'chan-1':\n...\nbreak;\ncase 'chan-2':\n...\nbreak;\ncase 'chan-2':\n...\nbreak;\n}\n}\n$redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); \/\/ subscribe to 3 chans\n<\/pre>","parameters":{"channels":{"comment":"订阅的消息频道","type":"array","options":[]},"callback":{"comment":"回调函数名称","type":"string|array","options":[]},"value":{"comment":"返回值","type":"mixed","options":[]}}},"psubscribe":{"access":"public","comment":"通过匹配模式来订阅这些匹配的消息频道","isStatic":false,"return":"","example":"\n
\nfunction psubscribe($redis, $pattern, $chan, $msg) {\necho \"Pattern: $pattern\\n\";\necho \"Channel: $chan\\n\";\necho \"Payload: $msg\\n\";\n}\n<\/pre>","parameters":{"patterns":{"comment":"匹配模式","type":"array","options":[]},"callback":{"comment":"回调函数名称","type":"string|array","options":[]},"value":{"comment":"返回值","type":"mixed","options":[]}}},"unsubscribe":{"access":"public","comment":"取消订阅","isStatic":false,"return":"","example":"","parameters":{"channels":{"comment":"订阅的消息频道","type":"array","options":[]}}},"punsubscribe":{"access":"public","comment":"通过匹配模式来取消订阅这些匹配的消息频道","isStatic":false,"return":"","example":"","parameters":{"patterns":{"comment":"匹配模式","type":"array","options":[]}}},"eval":{"access":"public","comment":"执行lua脚本","isStatic":false,"return":"mixed","example":"","parameters":{"script":{"comment":"脚本","type":"string","options":[]},"args":{"comment":"脚本参数","type":"array","options":[]},"num_keys":{"comment":"应该进入KEYS数组的参数个数","type":"int","options":[]}}},"evalsha":{"access":"public","comment":"从脚本的SHA1散列而不是脚本本身执行LUA脚本","isStatic":false,"return":"","example":"$script = 'return 1';\n$sha = $redis->script('load', $script);\n$redis->evalSha($sha); \/\/ Returns 1","parameters":{"script_sha":{"comment":"脚本的散列值","type":"string","options":[]},"args":{"comment":"脚本参数","type":"array","options":[]},"num_keys":{"comment":"应该进入KEYS数组的参数个数","type":"int","options":[]}}},"scan":{"access":"public","comment":"扫描键空间.","isStatic":false,"return":"array","example":"\n
\n$iterator = null;\nwhile($keys = $redis->scan($iterator)) {\nforeach($keys as $key) {\necho $key . PHP_EOL;\n}\n}\n<\/pre>","parameters":{"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"hscan":{"access":"public","comment":"扫描hash的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"zscan":{"access":"public","comment":"扫描有序集合的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"sscan":{"access":"public","comment":"扫描集合的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"getmode":{"access":"public","comment":"获取运行模式,如 ATOMIC\/MULTI\/PIPELINE","isStatic":false,"return":"int","example":"$redis->getMode();","parameters":[]},"getLastError":{"access":"public","comment":"获取上次错误信息","isStatic":false,"return":"string","example":"\n
\n$redis->eval('this-is-not-lua');\n$err = $redis->getLastError();\n\/\/ \"ERR Error compiling script (new function): user_script:1: '=' expected near '-'\"\n<\/pre>","parameters":[]},"clearLastError":{"access":"public","comment":"清除上次错误信息","isStatic":false,"return":"bool","example":"\n
\n$redis->set('x', 'a');\n$redis->incr('x');\n$err = $redis->getLastError();\n\/\/ \"ERR value is not an integer or out of range\"\n$redis->clearLastError();\n$err = $redis->getLastError();\n\/\/ NULL\n<\/pre>","parameters":[]},"getOption":{"access":"public","comment":"获取客户端选项","isStatic":false,"return":"int","example":"\n\/\/ return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY.\n$redis->getOption(Redis::OPT_SERIALIZER);","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]}}},"setOption":{"access":"public","comment":"设置客户端选项.","isStatic":false,"return":"bool:","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        \/\/ don't serialize data\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         \/\/ use built-in serialize\/unserialize\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    \/\/ use igBinary serialize\/unserialize\n$redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      \/\/ use custom prefix on all keys\n<\/pre>","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]},"optionValue":{"comment":"选项值","type":"string","options":[]}}},"_prefix":{"access":"public","comment":"设置键前缀","isStatic":false,"return":"string","example":"\n
\n$redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');\n$redis->_prefix('my-value'); \/\/ Will return 'my-prefix:my-value'\n<\/pre>","parameters":{"prefix":{"comment":"前缀","type":"string","options":[]}}},"_serialize":{"access":"public","comment":"用于手动序列化.","isStatic":false,"return":"","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);\n$redis->_serialize(\"foo\"); \/\/ returns \"foo\"\n$redis->_serialize(Array()); \/\/ Returns \"Array\"\n$redis->_serialize(new stdClass()); \/\/ Returns \"Object\"\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);\n$redis->_serialize(\"foo\"); \/\/ Returns 's:3:\"foo\";'\n<\/pre>","parameters":{"value":{"comment":"被序列化的值","type":"string","options":[]}}},"_unserialize":{"access":"public","comment":"反序列化方法.","isStatic":false,"return":"","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);\n$redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); \/\/ Will return Array(1,2,3)\n<\/pre>","parameters":{"value":{"comment":"被反序列化的值","type":"string","options":[]}}},"_masters":{"access":"public","comment":"获取集群中的主服务器列表","isStatic":false,"return":"array","example":"foreach ($obj_cluster->_masters() as $arr_master) {\n$obj_cluster->echo($arr_master, \"Hello: \" . implode(':', $arr_master));\n}","parameters":[]},"_redir":{"access":"public","comment":"获取跳转的地址,格式为:host:port","isStatic":false,"return":"string|NULL","example":"","parameters":[]},"multi":{"access":"public","comment":"开始一个事务.","isStatic":false,"return":"","example":"\n
\n$ret = $redis->multi()\n->set('key1', 'val1')\n->get('key1')\n->set('key2', 'val2')\n->get('key2')\n->exec();\n\/\/$ret == array (\n\/\/    0 => TRUE,\n\/\/    1 => 'val1',\n\/\/    2 => TRUE,\n\/\/    3 => 'val2');\n<\/pre>","parameters":[]},"discard":{"access":"public","comment":"取消事务","isStatic":false,"return":"","example":"","parameters":[]},"exec":{"access":"public","comment":"执行事务","isStatic":false,"return":"","example":"","parameters":[]},"watch":{"access":"public","comment":"观察某个键在其他客户端的变化情况.","isStatic":false,"return":"","example":"\n
\n$redis->watch('x');\n\/\/ long code here during the execution of which other clients could well modify `x`\n$ret = $redis->multi()\n->incr('x')\n->exec();\n\/\/ $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.\n<\/pre>","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"unwatch":{"access":"public","comment":"取消观察某个键在其他客户端的变化情况","isStatic":false,"return":"","example":"","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"save":{"access":"public","comment":"将数据同步到硬盘上","isStatic":false,"return":"boolean","example":"$redis->save();","parameters":[]},"bgSave":{"access":"public","comment":"将数据存入到硬盘上(异步操作)","isStatic":false,"return":"","example":"","parameters":[]},"flushdb":{"access":"public","comment":"删除当前数据库的所有键","isStatic":false,"return":"bool","example":"$redis->flushDB();","parameters":[]},"flushall":{"access":"public","comment":"删除当前实例的所有键","isStatic":false,"return":"bool","example":"$redis->flushAll();","parameters":[]},"dbsize":{"access":"public","comment":"获取当前数据库的键的个数","isStatic":false,"return":"int","example":"\n
\n$count = $redis->dbSize();\necho \"Redis has $count keys\\n\";\n<\/pre>","parameters":[]},"bgrewriteaof":{"access":"public","comment":"开启后台写AOF日志操作","isStatic":false,"return":"bool","example":"$redis->bgrewriteaof();","parameters":[]},"lastsave":{"access":"public","comment":"获取上次数据同步到硬盘的时间","isStatic":false,"return":"int","example":"$redis->lastSave();","parameters":[]},"info":{"access":"public","comment":"获取Redis服务器的信息和统计数据","isStatic":false,"return":"array","example":"\n
\n$redis->info();\nor\n$redis->info(\"COMMANDSTATS\"); \/\/Information on the commands that have been run (>=2.6 only)\n$redis->info(\"CPU\"); \/\/ just CPU information from Redis INFO\n<\/pre>","parameters":[]},"role":{"access":"public","comment":"返回当前连接的服务器的角色,如master、alone、slave、sentinel","isStatic":false,"return":"string","example":"","parameters":[]},"time":{"access":"public","comment":"返回当前redis服务器时间.","isStatic":false,"return":"int","example":"\n
\nvar_dump( $redis->time() );\n\/\/ array(2) {\n\/\/   [0] => string(10) \"1342364352\"\n\/\/   [1] => string(6) \"253002\"\n\/\/ }\n<\/pre>","parameters":[]},"randomkey":{"access":"public","comment":"返回一个随机的键","isStatic":false,"return":"string","example":"\n
\n$key = $redis->randomKey();\n$surprise = $redis->get($key);  \/\/ who knows what's in there.\n<\/pre>","parameters":[]},"ping":{"access":"public","comment":"检查当前redis连接状态(成功时返回PONG)","isStatic":false,"return":"string","example":"","parameters":[]},"echo":{"access":"public","comment":"向redis发送一个字符串,而且redis服务器将返回一个相同的字符串","isStatic":false,"return":"string","example":"","parameters":{"str":{"comment":"发送的字符串","type":"string","options":[]}}},"command":{"access":"public","comment":"获取所有命令列表","isStatic":false,"return":"array","example":"","parameters":[]},"rawcommand":{"access":"public","comment":"在redis服务器上执行命令","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"执行的命令","type":"string","options":[]},"args":{"comment":"参数","type":"string|array","options":[]}}},"cluster":{"access":"public","comment":"获取集群节点信息","isStatic":false,"return":"array","example":"","parameters":{"args":{"comment":"参数(目前只支持slots)","type":"string","options":[]}}},"client":{"access":"public","comment":"获取客户端相关参数或进行相关操作","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"命令(CLIENT LIST\nCLIENT GETNAME\nCLIENT SETNAME [name]\nCLIENT KILL [ip:port]\n)","type":"string","options":[]},"args":{"comment":"参数","type":"string","options":[]}}},"config":{"access":"public","comment":"获取或设置配置项.","isStatic":false,"return":"array","example":"\n
\n$redis->config(\"GET\", \"*max-*-entries*\");\n$redis->config(\"SET\", \"dir\", \"\/var\/run\/redis\/dumps\/\");\n<\/pre>","parameters":{"operation":{"comment":"操作(SET或GET)","type":"string","options":[]},"key":{"comment":"配置项或配置项匹配模式","type":"string","options":[]},"value":{"comment":"配置值","type":"string","options":[]}}},"pubsub":{"access":"public","comment":"查看订阅与发布系统状态,它由数个不同格式的子命令组成.","isStatic":false,"return":"array|int","example":"\n
\n$redis->pubsub('channels'); \/\/ All channels\n$redis->pubsub('channels', '*pattern*'); \/\/ Just channels matching your pattern\n$redis->pubsub('numsub', array('chan1', 'chan2')); \/\/ Get subscriber counts for 'chan1' and 'chan2'\n$redis->pubsub('numpat'); \/\/ Get the number of pattern subscribers\n<\/pre>","parameters":{"subcommand":{"comment":"子命令(可以是channels, numsub, numpat)","type":"string","options":[]},"args":{"comment":"参数","type":"string|array","options":[]}}},"script":{"access":"public","comment":"在脚本子系统上执行redis命令","isStatic":false,"return":"","example":"\n
\n$redis->script('load', $script);\n$redis->script('flush');\n$redis->script('kill');\n$redis->script('exists', $script1, [$script2, $script3, ...]);\n<\/pre>\nSCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure.\nSCRIPT FLUSH should always return TRUE\nSCRIPT KILL will return true if a script was able to be killed and false if not\nSCRIPT EXISTS will return an array with TRUE or FALSE for each passed script","parameters":{"command":{"comment":"redis命令","type":"string","options":[]},"script":{"comment":"脚本","type":"string|...","options":[]}}},"slowlog":{"access":"public","comment":"获取慢操作日志","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"执行的命令","type":"string","options":[]},"length":{"comment":"获取条目数","type":"int","options":[]}}}}}
\ No newline at end of file
+{"object":{"name":"RedisCluster"},"comment":"redis集群客户端","namespace":"","interfaces":[],"consts":{"REDIS_NOT_FOUND":{"comment":"未知类型","type":"int","value":0},"REDIS_STRING":{"comment":"字符串类型","type":"int","value":1},"REDIS_SET":{"comment":"集合类型","type":"int","value":2},"REDIS_LIST":{"comment":"列表类型","type":"int","value":3},"REDIS_ZSET":{"comment":"有序集合类型","type":"int","value":4},"REDIS_HASH":{"comment":"字典类型","type":"int","value":5},"ATOMIC":{"comment":"原子操作模式","type":"int","value":0},"MULTI":{"comment":"事务模式","type":"int","value":1},"OPT_SERIALIZER":{"comment":"序列化选项","type":"int","value":1},"OPT_PREFIX":{"comment":"前缀选项","type":"int","value":2},"OPT_READ_TIMEOUT":{"comment":"读操作超时选项","type":"unknown","value":3},"OPT_TCP_KEEPALIVE":{"comment":"","type":"int","value":6},"OPT_COMPRESSION":{"comment":"","type":"int","value":7},"SERIALIZER_NONE":{"comment":"不实行序列化","type":"int","value":0},"SERIALIZER_PHP":{"comment":"PHP序列化","type":"int","value":1},"COMPRESSION_NONE":{"comment":"","type":"int","value":0},"OPT_SCAN":{"comment":"扫描选项","type":"int","value":4},"SCAN_RETRY":{"comment":"重新扫描","type":"int","value":1},"SCAN_NORETRY":{"comment":"不重新扫描","type":"int","value":0},"OPT_SLAVE_FAILOVER":{"comment":"","type":"int","value":5},"FAILOVER_NONE":{"comment":"不使用failover机制","type":"int","value":0},"FAILOVER_ERROR":{"comment":"failover错误","type":"int","value":1},"FAILOVER_DISTRIBUTE":{"comment":"使用分布式failover机制(failover是指一个master有N(N>=1)个slave,当master挂掉以后,能选出一个slave晋升成Master继续提供服务。Failover由失败判定和Leader选举两部分组成,Redis Cluster采用去中心化(Gossip)的设计,每个节点通过发送Ping(包括Gossip信息)\/Pong心跳的方式来探测对方节点的存活,如果心跳超时则标记对方节点的状态为PFail,这个意思是说该节点认为对方节点可能失败了,有可能是网络闪断或者分区等其他原因导致通讯失败)","type":"int","value":2},"FAILOVER_DISTRIBUTE_SLAVES":{"comment":"","type":"int","value":3},"AFTER":{"comment":"后面位置","type":"string","value":"after"},"BEFORE":{"comment":"前面位置","type":"string","value":"before"}},"properties":[],"methods":{"__construct":{"access":"public","comment":"创建一个集群对象","isStatic":false,"return":"","example":"$redis = new RedisCluster(null, array('127.0.0.1:6379', '127.0.0.1:6380'));","parameters":{"name":{"comment":"集群名称(在php.ini配置文件或redis.ini配置文件中配置,不配置则为NULL)","type":"string","options":[]},"config":{"comment":"连接的集群节点配置项,如array('127.0.0.1:6379', '127.0.0.1:6380')","type":"array","options":[]},"timeout":{"comment":"连接超时时间","type":"float","options":[]},"read_timeout":{"comment":"读操作超时时间","type":"float","options":[]},"persistent":{"comment":"与每个节点持久化连接","type":"boolean","options":[]}}},"close":{"access":"public","comment":"关闭redis连接(长连接除外)","isStatic":false,"return":"","example":"","parameters":[]},"get":{"access":"public","comment":"获取指定的key的值","isStatic":false,"return":"string|bool","example":"$redis->get('key');","parameters":[]},"set":{"access":"public","comment":"给指定的键设置值","isStatic":false,"return":"bool","example":"直接设置:\n $redis->set('key', 'value');\n带有效期的设置:\n$redis->set('key','value', 10);\n当键不存在时,设置期有效期为10秒:\n$redis->set('key', 'value', Array('nx', 'ex'=>10));\n当键存在时,设置期有效期为1000毫秒:\n$redis->set('key', 'value', Array('xx', 'px'=>1000));\n","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"options":{"comment":"附加项,可以是超时时间或者一个选项数组","type":"int|array","options":[]}}},"mget":{"access":"public","comment":"批量获取键名","isStatic":false,"return":"","example":"\n
\n$redis->delete('x', 'y', 'z', 'h');\t\/\/ remove x y z\n$redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));\n$redis->hset('h', 'field', 'value');\nvar_dump($redis->mget(array('x', 'y', 'z', 'h')));\n\/\/ Output:\n\/\/ array(3) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ bool(false)\n\/\/ }\n<\/pre>","parameters":{"keys":{"comment":"键名数组","type":"array","options":[]}}},"mset":{"access":"public","comment":"批量设置值","isStatic":false,"return":"bool","example":"\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>","parameters":{"values":{"comment":"要设置的键值对","type":"array","options":[]}}},"msetnx":{"access":"public","comment":"批量设置值(当不存在时设置)","isStatic":false,"return":"bool","example":"\n
\n$redis->mset(array('key0' => 'value0', 'key1' => 'value1'));\nvar_dump($redis->get('key0'));\nvar_dump($redis->get('key1'));\n\/\/ Output:\n\/\/ string(6) \"value0\"\n\/\/ string(6) \"value1\"\n<\/pre>","parameters":{"values":{"comment":"要设置的键值对","type":"array","options":[]}}},"del":{"access":"public","comment":"删除一个或多个键","isStatic":false,"return":"int","example":"$redis->delete('key1', 'key2'); \n$redis->delete(array('key3', 'key4')); ","parameters":{"keys":{"comment":"键名","type":"array|string","options":[]}}},"setex":{"access":"public","comment":"设置键值并设置有效期","isStatic":false,"return":"bool","example":"$redis->setex('key', 3600, 'value');","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"ttl":{"comment":"有效期","type":"int","options":[]}}},"psetex":{"access":"public","comment":"设置键值并设置有效期(毫秒为单位)","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]},"ttl":{"comment":"有效期(毫秒为单位)","type":"int","options":[]}}},"setnx":{"access":"public","comment":"当键不存在时设置其值","isStatic":false,"return":"bool:","example":"\n$redis->setnx('key', 'value');\n","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]}}},"getset":{"access":"public","comment":"设置键的值,并返回它的旧的缓存值","isStatic":false,"return":"string","example":"\n
\n$redis->set('x', '42');\n$exValue = $redis->getSet('x', 'lol');   \/\/ return '42', replaces x by 'lol'\n$newValue = $redis->get('x')'            \/\/ return 'lol'\n<\/pre>","parameters":{"key":{"comment":"设置的缓存键","type":"string","options":[]},"value":{"comment":"设置的缓存值","type":"string","options":[]}}},"exists":{"access":"public","comment":"判断键是否存在","isStatic":false,"return":"bool","example":"\n
\n$redis->set('key', 'value');\n$redis->exists('key');               \/\/  TRUE\n$redis->exists('NonExistingKey');    \/\/ FALSE\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"keys":{"access":"public","comment":"根据匹配模式获取键名(如*)","isStatic":false,"return":"array","example":"\n$allKeys = $redis->keys('*');\n$keyWithUserPrefix = $redis->keys('user*');","parameters":{"pattern":{"comment":"匹配模式","type":"string","options":[]}}},"type":{"access":"public","comment":"获取指定键的数据类型(需要根据常量匹配)","isStatic":false,"return":"int","example":"$redis->type('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"lPop":{"access":"public","comment":"从列表左侧删除一个元素","isStatic":false,"return":"string","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->lPop('key1');        \/\/ key1 => [ 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"rPop":{"access":"public","comment":"从列表右侧删除一个元素","isStatic":false,"return":"string","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->rPop('key1');        \/\/ key1 => [ 'A', 'B' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"lset":{"access":"public","comment":"给列表指定位置设置新值","isStatic":false,"return":"boolean","example":"\n
\n$redis->rPush('key1', 'A');\n$redis->rPush('key1', 'B');\n$redis->rPush('key1', 'C');  \/\/ key1 => [ 'A', 'B', 'C' ]\n$redis->lGet('key1', 0);     \/\/ 'A'\n$redis->lSet('key1', 0, 'X');\n$redis->lGet('key1', 0);     \/\/ 'X'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]},"value":{"comment":"新值","type":"string","options":[]}}},"spop":{"access":"public","comment":"随机删除元素的某个或某些成员,并返回这个删除的成员.","isStatic":false,"return":"string | bool","example":"\n
\n$redis->sAdd('key1' , 'set1');\n$redis->sAdd('key1' , 'set2');\n$redis->sAdd('key1' , 'set3');   \/\/ 'key1' => {'set3', 'set1', 'set2'}\n$redis->sPop('key1');            \/\/ 'set1', 'key1' => {'set3', 'set2'}\n$redis->sPop('key1');            \/\/ 'set3', 'key1' => {'set2'}\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"count":{"comment":"删除个数","type":"int","options":[]}}},"lPush":{"access":"public","comment":"从左侧(头部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   \/\/ int(4)\nvar_dump( $redis->lRange('l', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(4) {\n\/\/   [0]=> string(2) \"v4\"\n\/\/   [1]=> string(2) \"v3\"\n\/\/   [2]=> string(2) \"v2\"\n\/\/   [3]=> string(2) \"v1\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"rPush":{"access":"public","comment":"从右侧(尾部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    \/\/ int(4)\nvar_dump( $redis->lRange('l', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(4) {\n\/\/   [0]=> string(2) \"v1\"\n\/\/   [1]=> string(2) \"v2\"\n\/\/   [2]=> string(2) \"v3\"\n\/\/   [3]=> string(2) \"v4\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"blPop":{"access":"public","comment":"是一个阻塞lPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表头部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,blPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。","isStatic":false,"return":"array","example":"\n
\n\/\/ Non blocking feature\n$redis->lPush('key1', 'A');\n$redis->delete('key2');\n$redis->blPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->blPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n$redis->brPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->brPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n\/\/ Blocking feature\n\/\/ process 1\n$redis->delete('key1');\n$redis->blPop('key1', 10);\n\/\/ blocking for 10 seconds\n\/\/ process 2\n$redis->lPush('key1', 'A');\n\/\/ process 1\n\/\/ array('key1', 'A') is returned\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]},"timeout":{"comment":"超时时间","type":"int","options":[]}}},"brPop":{"access":"public","comment":"是一个阻塞rPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表尾部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,brPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。","isStatic":false,"return":"array","example":"\n
\n\/\/ Non blocking feature\n$redis->lPush('key1', 'A');\n$redis->delete('key2');\n$redis->blPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->blPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n$redis->brPop('key1', 'key2', 10); \/\/ array('key1', 'A')\n\/\/ OR\n$redis->brPop(array('key1', 'key2'), 10); \/\/ array('key1', 'A')\n\/\/ Blocking feature\n\/\/ process 1\n$redis->delete('key1');\n$redis->blPop('key1', 10);\n\/\/ blocking for 10 seconds\n\/\/ process 2\n$redis->lPush('key1', 'A');\n\/\/ process 1\n\/\/ array('key1', 'A') is returned\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]},"timeout":{"comment":"超时时间","type":"int","options":[]}}},"lPushx":{"access":"public","comment":"如果列表存在,从左侧(头部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->lPushx('key1', 'A');     \/\/ returns 0\n$redis->lPush('key1', 'A');      \/\/ returns 1\n$redis->lPushx('key1', 'B');     \/\/ returns 2\n$redis->lPushx('key1', 'C');     \/\/ returns 3\n\/\/ key1 now points to the following list: [ 'A', 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"rPushx":{"access":"public","comment":"如果列表存在,从右侧(尾部)向列表插入元素","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->rPushx('key1', 'A'); \/\/ returns 0\n$redis->rPush('key1', 'A'); \/\/ returns 1\n$redis->rPushx('key1', 'B'); \/\/ returns 2\n$redis->rPushx('key1', 'C'); \/\/ returns 3\n\/\/ key1 now points to the following list: [ 'A', 'B', 'C' ]\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"linsert":{"access":"public","comment":"在列表中,在某个元素的前面或后面插入一个新值","isStatic":false,"return":"int","example":"\n
\n$redis->delete('key1');\n$redis->lInsert('key1', Redis::AFTER, 'A', 'X');     \/\/ 0\n$redis->lPush('key1', 'A');\n$redis->lPush('key1', 'B');\n$redis->lPush('key1', 'C');\n$redis->lInsert('key1', Redis::BEFORE, 'C', 'X');    \/\/ 4\n$redis->lRange('key1', 0, -1);                       \/\/ array('A', 'B', 'X', 'C')\n$redis->lInsert('key1', Redis::AFTER, 'C', 'Y');     \/\/ 5\n$redis->lRange('key1', 0, -1);                       \/\/ array('A', 'B', 'X', 'C', 'Y')\n$redis->lInsert('key1', Redis::AFTER, 'W', 'value'); \/\/ -1\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"position":{"comment":"位置(前面或后面,使用Redis::BEFORE | Redis::AFTER)","type":"string","options":[]},"element":{"comment":"元素","type":"string","options":[]},"value":{"comment":"新值","type":"string","options":[]}}},"lindex":{"access":"public","comment":"获取列表中指定索引的值","isStatic":false,"return":"string | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]}}},"lrem":{"access":"public","comment":"从列表中删除指定值的元素。 如果count为零,则删除所有匹配的元素。 如果计数是负数,则元素从尾部移到头部。","isStatic":false,"return":"long | bool","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]},"count":{"comment":"删除的个数","type":"int","options":[]}}},"rpoplpush":{"access":"public","comment":"从一个队列的队尾删除一个元素,并将该元素插入到另一个队列的头部","isStatic":false,"return":"string","example":"\n
\n$redis->delete('x', 'y');\n$redis->lPush('x', 'abc');\n$redis->lPush('x', 'def');\n$redis->lPush('y', '123');\n$redis->lPush('y', '456');\n\/\/ move the last of x to the front of y.\nvar_dump($redis->rpoplpush('x', 'y'));\nvar_dump($redis->lRange('x', 0, -1));\nvar_dump($redis->lRange('y', 0, -1));\n\/\/Output:\n\/\/\n\/\/string(3) \"abc\"\n\/\/array(1) {\n\/\/  [0]=>\n\/\/  string(3) \"def\"\n\/\/}\n\/\/array(3) {\n\/\/  [0]=>\n\/\/  string(3) \"abc\"\n\/\/  [1]=>\n\/\/  string(3) \"456\"\n\/\/  [2]=>\n\/\/  string(3) \"123\"\n\/\/}\n<\/pre>","parameters":{"srcKey":{"comment":"要删除元素的队列键名","type":"string","options":[]},"dstKey":{"comment":"要插入元素的队列的键名","type":"string","options":[]}}},"brpoplpush":{"access":"public","comment":"阻塞执行rpoplpush","isStatic":false,"return":"string","example":"","parameters":{"srcKey":{"comment":"要删除元素的队列键名","type":"string","options":[]},"dstKey":{"comment":"要插入元素的队列的键名","type":"string","options":[]}}},"llen":{"access":"public","comment":"返回列表的长度","isStatic":false,"return":"long | bool","example":"","parameters":{"key":{"comment":"键名","type":"string|...|array","options":[]}}},"scard":{"access":"public","comment":"返回集合的元素个数","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"smembers":{"access":"public","comment":"返回集合的所有成员","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s');\n$redis->sAdd('s', 'a');\n$redis->sAdd('s', 'b');\n$redis->sAdd('s', 'a');\n$redis->sAdd('s', 'c');\nvar_dump($redis->sMembers('s'));\n\/\/array(3) {\n\/\/  [0]=>\n\/\/  string(1) \"c\"\n\/\/  [1]=>\n\/\/  string(1) \"a\"\n\/\/  [2]=>\n\/\/  string(1) \"b\"\n\/\/}\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"sismember":{"access":"public","comment":"是否包含某个成员","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"sAdd":{"access":"public","comment":"给集合添加元素","isStatic":false,"return":"int","example":"\n
\n$redis->sAdd('k', 'v1');                \/\/ int(1)\n$redis->sAdd('k', 'v1', 'v2', 'v3');    \/\/ int(2)\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"sAddArray":{"access":"public","comment":"给集合批量添加元素","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"元素值","type":"array","options":[]}}},"srem":{"access":"public","comment":"删除集合元素","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"member":{"comment":"成员","type":"string|...","options":[]}}},"sUnion":{"access":"public","comment":"获取集合的并集","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s1', '3');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\n$redis->sAdd('s2', '4');\nvar_dump($redis->sUnion('s0', 's1', 's2'));\narray(4) {\n\/\/  [0]=>\n\/\/  string(1) \"3\"\n\/\/  [1]=>\n\/\/  string(1) \"4\"\n\/\/  [2]=>\n\/\/  string(1) \"1\"\n\/\/  [3]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string|...","options":[]}}},"sUnionStore":{"access":"public","comment":"获取多个集合的并集,并将结果存入到另外一个集合中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s1', '3');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\n$redis->sAdd('s2', '4');\nvar_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));\nvar_dump($redis->sMembers('dst'));\n\/\/int(4)\n\/\/array(4) {\n\/\/  [0]=>\n\/\/  string(1) \"3\"\n\/\/  [1]=>\n\/\/  string(1) \"4\"\n\/\/  [2]=>\n\/\/  string(1) \"1\"\n\/\/  [3]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"sInter":{"access":"public","comment":"获取两个集合的交集","isStatic":false,"return":"array | boolean","example":"\n
\n$redis->sAdd('key1', 'val1');\n$redis->sAdd('key1', 'val2');\n$redis->sAdd('key1', 'val3');\n$redis->sAdd('key1', 'val4');\n$redis->sAdd('key2', 'val3');\n$redis->sAdd('key2', 'val4');\n$redis->sAdd('key3', 'val3');\n$redis->sAdd('key3', 'val4');\nvar_dump($redis->sInter('key1', 'key2', 'key3'));\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(4) \"val4\"\n\/\/  [1]=>\n\/\/  string(4) \"val3\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]}}},"sInterStore":{"access":"public","comment":"获取多个集合的交集,并将结果存入到另外一个集合中","isStatic":false,"return":"int","example":"\n
\n$redis->sAdd('key1', 'val1');\n$redis->sAdd('key1', 'val2');\n$redis->sAdd('key1', 'val3');\n$redis->sAdd('key1', 'val4');\n$redis->sAdd('key2', 'val3');\n$redis->sAdd('key2', 'val4');\n$redis->sAdd('key3', 'val3');\n$redis->sAdd('key3', 'val4');\nvar_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));\nvar_dump($redis->sMembers('output'));\n\/\/int(2)\n\/\/\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(4) \"val4\"\n\/\/  [1]=>\n\/\/  string(4) \"val3\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"sDiff":{"access":"public","comment":"获取多个集合的差集","isStatic":false,"return":"array","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s0', '3');\n$redis->sAdd('s0', '4');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\nvar_dump($redis->sDiff('s0', 's1', 's2'));\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(1) \"4\"\n\/\/  [1]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string|...","options":[]}}},"sDiffStore":{"access":"public","comment":"获取多个集合的差集,并将结果存入到一个新的集合中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('s0', 's1', 's2');\n$redis->sAdd('s0', '1');\n$redis->sAdd('s0', '2');\n$redis->sAdd('s0', '3');\n$redis->sAdd('s0', '4');\n$redis->sAdd('s1', '1');\n$redis->sAdd('s2', '3');\nvar_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));\nvar_dump($redis->sMembers('dst'));\n\/\/int(2)\n\/\/array(2) {\n\/\/  [0]=>\n\/\/  string(1) \"4\"\n\/\/  [1]=>\n\/\/  string(1) \"2\"\n\/\/}\n<\/pre>","parameters":{"dstKey":{"comment":"目标键,存放结果的键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名n","type":"string|...","options":[]}}},"srandmember":{"access":"public","comment":"随机返回一个集合的元素(不会删除它)","isStatic":false,"return":"string | bool","example":"\n
\n$redis->sAdd('key1' , 'one');\n$redis->sAdd('key1' , 'two');\n$redis->sAdd('key1' , 'three');              \/\/ 'key1' => {'one', 'two', 'three'}\nvar_dump( $redis->sRandMember('key1') );     \/\/ 'key1' => {'one', 'two', 'three'}\n\/\/ string(5) \"three\"\nvar_dump( $redis->sRandMember('key1', 2) );  \/\/ 'key1' => {'one', 'two', 'three'}\n\/\/ array(2) {\n\/\/   [0]=> string(2) \"one\"\n\/\/   [1]=> string(2) \"three\"\n\/\/ }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"strlen":{"access":"public","comment":"获取键值的长度","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', 'value');\n$redis->strlen('key'); \/\/ 5\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"persist":{"access":"public","comment":"移除指定键的有效期,让它永久有效","isStatic":false,"return":"bool:","example":"$redis->persist('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"ttl":{"access":"public","comment":"返回指定键的有效时间(秒)","isStatic":false,"return":"long","example":"$redis->ttl('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"pttl":{"access":"public","comment":"返回指定键的有效时间(毫秒)","isStatic":false,"return":"long","example":"$redis->pttl('key');","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"zcard":{"access":"public","comment":"获取有序集合的成员数","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zCard('key');            \/\/ 3\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]}}},"zcount":{"access":"public","comment":"获取指定排序范围的成员数.","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zCount('key', 0, 3); \/\/ 2, corresponding to array('val0', 'val2')\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"zremrangebyscore":{"access":"public","comment":"根据排序值范围来删除成员","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"zscore":{"access":"public","comment":"获取指定成员的排序值(分数)","isStatic":false,"return":"double","example":"\n
\n$redis->zAdd('key', 2.5, 'val2');\n$redis->zScore('key', 'val2'); \/\/ 2.5\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"zadd":{"access":"public","comment":"向有序集合插入元素","isStatic":false,"return":"int","example":"\n
\n
\n$redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  \/\/ int(2)\n$redis->zRem('z', 'v2', 'v3');                           \/\/ int(2)\nvar_dump( $redis->zRange('z', 0, -1) );\n\/\/\/\/ Output:\n\/\/ array(2) {\n\/\/   [0]=> string(2) \"v1\"\n\/\/   [1]=> string(2) \"v4\"\n\/\/ }\n<\/pre>\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"score":{"comment":"排序值","type":"double","options":[]},"value":{"comment":"元素值","type":"string","options":[]}}},"zincrby":{"access":"public","comment":"给有序集合成员增加排序值","isStatic":false,"return":"float","example":"\n
\n$redis->delete('key');\n$redis->zIncrBy('key', 2.5, 'member1');  \/\/ key or member1 didn't exist, so member1's score is to 0\n\/\/ before the increment and now has the value 2.5\n$redis->zIncrBy('key', 1, 'member1');    \/\/ 3.5\n<\/pre>","parameters":{"key":{"comment":"目标集合键名","type":"string","options":[]},"step":{"comment":"增加的步长","type":"double","options":[]},"member":{"comment":"成员","type":"string","options":[]}}},"hGet":{"access":"public","comment":"获取字典的某个字段的值","isStatic":false,"return":"string","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]}}},"hSet":{"access":"public","comment":"为字典的字段设置值","isStatic":false,"return":"long","example":"\n
\n$redis->delete('h')\n$redis->hSet('h', 'key1', 'hello');  \/\/ 1, 'key1' => 'hello' in the hash at \"h\"\n$redis->hGet('h', 'key1');           \/\/ returns \"hello\"\n$redis->hSet('h', 'key1', 'plop');   \/\/ 0, value was replaced.\n$redis->hGet('h', 'key1');           \/\/ returns \"plop\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"value":{"comment":"字段值","type":"string","options":[]}}},"hSetNx":{"access":"public","comment":"当字典的字段不存在时,为其设置值","isStatic":false,"return":"bool","example":"\n
\n$redis->delete('h')\n$redis->hSetNx('h', 'key1', 'hello'); \/\/ TRUE, 'key1' => 'hello' in the hash at \"h\"\n$redis->hSetNx('h', 'key1', 'world'); \/\/ FALSE, 'key1' => 'hello' in the hash at \"h\". No change since the field\nwasn't replaced.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"value":{"comment":"字段值","type":"string","options":[]}}},"hDel":{"access":"public","comment":"删除字典的某个或某些字段","isStatic":false,"return":"int","example":"\n
\n$redis->hMSet('h',\narray(\n'f1' => 'v1',\n'f2' => 'v2',\n'f3' => 'v3',\n'f4' => 'v4',\n));\nvar_dump( $redis->hDel('h', 'f1') );        \/\/ int(1)\nvar_dump( $redis->hDel('h', 'f2', 'f3') );  \/\/ int(2)\ns\nvar_dump( $redis->hGetAll('h') );\n\/\/\/\/ Output:\n\/\/  array(1) {\n\/\/    [\"f4\"]=> string(2) \"v4\"\n\/\/  }\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段名","type":"string|array","options":[]}}},"hLen":{"access":"public","comment":"获取字典的字段个数","isStatic":false,"return":"int","example":"\n
\n$redis->delete('h')\n$redis->hSet('h', 'key1', 'hello');\n$redis->hSet('h', 'key2', 'plop');\n$redis->hLen('h'); \/\/ returns 2\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hKeys":{"access":"public","comment":"获取字典的字段名称列表.","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hKeys('h'));\n\/\/ Output:\n\/\/ array(4) {\n\/\/ [0]=>\n\/\/ string(1) \"a\"\n\/\/ [1]=>\n\/\/ string(1) \"b\"\n\/\/ [2]=>\n\/\/ string(1) \"c\"\n\/\/ [3]=>\n\/\/ string(1) \"d\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hVals":{"access":"public","comment":"获取字典的字段值列表","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hVals('h'));\n\/\/ Output\n\/\/ array(4) {\n\/\/   [0]=>\n\/\/   string(1) \"x\"\n\/\/   [1]=>\n\/\/   string(1) \"y\"\n\/\/   [2]=>\n\/\/   string(1) \"z\"\n\/\/   [3]=>\n\/\/   string(1) \"t\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hGetAll":{"access":"public","comment":"获取字典所有字段键值对","isStatic":false,"return":"array","example":"\n
\n$redis->delete('h');\n$redis->hSet('h', 'a', 'x');\n$redis->hSet('h', 'b', 'y');\n$redis->hSet('h', 'c', 'z');\n$redis->hSet('h', 'd', 't');\nvar_dump($redis->hGetAll('h'));\n\/\/ Output:\n\/\/ array(4) {\n\/\/   [\"a\"]=>\n\/\/   string(1) \"x\"\n\/\/   [\"b\"]=>\n\/\/   string(1) \"y\"\n\/\/   [\"c\"]=>\n\/\/   string(1) \"z\"\n\/\/   [\"d\"]=>\n\/\/   string(1) \"t\"\n\/\/ }\n\/\/ The order is random and corresponds to redis' own internal representation of the set structure.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"hExists":{"access":"public","comment":"判断字典的某个字段是否存在.","isStatic":false,"return":"bool","example":"\n
\n$redis->hSet('h', 'a', 'x');\n$redis->hExists('h', 'a');               \/\/  TRUE\n$redis->hExists('h', 'NonExistingKey');  \/\/ FALSE\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]}}},"hIncrBy":{"access":"public","comment":"为指定字段增加指定的值.","isStatic":false,"return":"int","example":"\n
\n$redis->delete('h');\n$redis->hIncrBy('h', 'x', 2); \/\/ returns 2: h[x] = 2 now.\n$redis->hIncrBy('h', 'x', 1); \/\/ h[x] ← 2 + 1. Returns 3\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"step":{"comment":"自增步长","type":"int","options":[]}}},"hIncrByFloat":{"access":"public","comment":"为指定字段增加指定的值","isStatic":false,"return":"","example":"\n
\n$redis = new Redis();\n$redis->connect('127.0.0.1');\n$redis->hset('h', 'float', 3);\n$redis->hset('h', 'int',   3);\nvar_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); \/\/ float(4.5)\nvar_dump( $redis->hGetAll('h') );\n\/\/ Output\narray(2) {\n[\"float\"]=>\nstring(3) \"4.5\"\n[\"int\"]=>\nstring(1) \"3\"\n}\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"field":{"comment":"字段名","type":"string","options":[]},"step":{"comment":"自增步长","type":"double","options":[]}}},"hMset":{"access":"public","comment":"批量设置字典字段的值","isStatic":false,"return":"boolean","example":"\n
\n$redis->delete('user:1');\n$redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));\n$redis->hIncrBy('user:1', 'salary', 100); \/\/ Joe earns 100 more now.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段键值对","type":"array","options":[]}}},"hMget":{"access":"public","comment":"批量获取字典的字段值","isStatic":false,"return":"array","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"fields":{"comment":"字段名列表","type":"array","options":[]}}},"dump":{"access":"public","comment":"将某个键导出为一个二进制数据.","isStatic":false,"return":"string","example":"\n
\n$redis->set('foo', 'bar');\n$val = $redis->dump('foo'); \/\/ $val will be the Redis encoded key value\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"zRank":{"access":"public","comment":"获取成员的排序值","isStatic":false,"return":"int","example":"\n
\n$redis->delete('z');\n$redis->zAdd('key', 1, 'one');\n$redis->zAdd('key', 2, 'two');\n$redis->zRank('key', 'one');     \/\/ 0\n$redis->zRank('key', 'two');     \/\/ 1\n$redis->zRevRank('key', 'one');  \/\/ 1\n$redis->zRevRank('key', 'two');  \/\/ 0\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"zRevRank":{"access":"public","comment":"获取成员的排位值(倒数)","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"incr":{"access":"public","comment":"键值自增","isStatic":false,"return":"int","example":"\n
\n$redis->incr('key1'); \/\/ key1 didn't exists, set to 0 before the increment and now has the value 1\n$redis->incr('key1'); \/\/ 2\n$redis->incr('key1'); \/\/ 3\n$redis->incr('key1'); \/\/ 4\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"incrBy":{"access":"public","comment":"按指定步长自增","isStatic":false,"return":"int","example":"\n
\n$redis->incr('key1');        \/\/ key1 didn't exists, set to 0 before the increment and now has the value 1\n$redis->incr('key1');        \/\/ 2\n$redis->incr('key1');        \/\/ 3\n$redis->incr('key1');        \/\/ 4\n$redis->incrBy('key1', 10);  \/\/ 14\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自增步长","type":"int","options":[]}}},"incrByFloat":{"access":"public","comment":"按指定步长自增","isStatic":false,"return":"float","example":"\n
\n$redis = new Redis();\n$redis->connect('127.0.0.1');\n$redis->set('x', 3);\nvar_dump( $redis->incrByFloat('x', 1.5) );   \/\/ float(4.5)\n\/\/ ! SIC\nvar_dump( $redis->get('x') );                \/\/ string(3) \"4.5\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自增步长","type":"float","options":[]}}},"decr":{"access":"public","comment":"键值自减","isStatic":false,"return":"int","example":"\n
\n$redis->decr('key1'); \/\/ key1 didn't exists, set to 0 before the increment and now has the value -1\n$redis->decr('key1'); \/\/ -2\n$redis->decr('key1'); \/\/ -3\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"decrBy":{"access":"public","comment":"按指定步长自减","isStatic":false,"return":"int","example":"\n
\n$redis->decr('key1');        \/\/ key1 didn't exists, set to 0 before the increment and now has the value -1\n$redis->decr('key1');        \/\/ -2\n$redis->decr('key1');        \/\/ -3\n$redis->decrBy('key1', 10);  \/\/ -13\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"step":{"comment":"自减步长","type":"float","options":[]}}},"expire":{"access":"public","comment":"设置键的有效期","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期(秒数)","type":"int","options":[]}}},"expireAt":{"access":"public","comment":"为某个键设置有效期为某个时间点","isStatic":false,"return":"bool:","example":"\n
\n$redis->set('x', '42');\n$now = time(NULL);               \/\/ current timestamp\n$redis->expireAt('x', $now + 3); \/\/ x will disappear in 3 seconds.\nsleep(5);                        \/\/ wait 5 seconds\n$redis->get('x');                \/\/ will return `FALSE`, as 'x' has expired.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"expireTime":{"comment":"到期时间","type":"int","options":[]}}},"pexpire":{"access":"public","comment":"设置键的有效期(毫秒为单位)","isStatic":false,"return":"boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期(毫秒数)","type":"int","options":[]}}},"pexpireAt":{"access":"public","comment":"为某个键设置有效期为某个时间点(精确到毫秒)","isStatic":false,"return":"bool:","example":"\n
\n$redis->set('x', '42');\n$now = time(NULL);               \/\/ current timestamp\n$redis->expireAt('x', $now + 3); \/\/ x will disappear in 3 seconds.\nsleep(5);                        \/\/ wait 5 seconds\n$redis->get('x');                \/\/ will return `FALSE`, as 'x' has expired.\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"expireTime":{"comment":"到期时间","type":"int","options":[]}}},"append":{"access":"public","comment":"将字符串追加到键值后(返回值的长度)","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', 'value1');\n$redis->append('key', 'value2'); \/\/ 12\n$redis->get('key');              \/\/ 'value1value2'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"value":{"comment":"追加的值","type":"string","options":[]}}},"getBit":{"access":"public","comment":"获取某个键的某个位置的位值","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', \"\\x7f\");  \/\/ this is 0111 1111\n$redis->getBit('key', 0);    \/\/ 0\n$redis->getBit('key', 1);    \/\/ 1\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"所在位置","type":"int","options":[]}}},"setBit":{"access":"public","comment":"修改某个键的某个位置的位值","isStatic":false,"return":"int","example":"\n
\n$redis->set('key', \"*\");     \/\/ ord(\"*\") = 42 = 0x2f = \"0010 1010\"\n$redis->setBit('key', 5, 1); \/\/ returns 0\n$redis->setBit('key', 7, 1); \/\/ returns 0\n$redis->get('key');          \/\/ chr(0x2f) = \"\/\" = b(\"0010 1111\")\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"开始位置","type":"int","options":[]},"value":{"comment":"新值","type":"boolean|int","options":[]}}},"bitop":{"access":"public","comment":"多个键的位操作,并将结果存入到指定的键中","isStatic":false,"return":"long","example":"","parameters":{"operation":{"comment":"操作(有 AND, OR, NOT, XOR 4种可选择)","type":"string","options":[]},"dstKey":{"comment":"目标键","type":"string","options":[]},"key1":{"comment":"键名1","type":"string","options":[]},"key2":{"comment":"键名2","type":"string","options":[]},"keyN":{"comment":"键名N","type":"string|...","options":[]}}},"bitcount":{"access":"public","comment":"统计字符串的位数","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]}}},"bitpos":{"access":"public","comment":"获取指定位置的位值","isStatic":false,"return":"function","example":"\n
\n$redis->set('key', '\\xff\\xff');\n$redis->bitpos('key', 1); \/\/ int(0)\n$redis->bitpos('key', 1, 1); \/\/ int(8)\n$redis->bitpos('key', 1, 3); \/\/ int(-1)\n$redis->bitpos('key', 0); \/\/ int(16)\n$redis->bitpos('key', 0, 1); \/\/ int(16)\n$redis->bitpos('key', 0, 1, 5); \/\/ int(-1)\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"bit":{"comment":"位值","type":"int","options":[]},"start":{"comment":"开始位置","type":"int","options":[]},"end":{"comment":"结束位置","type":"int","options":[]}}},"lget":{"access":"public","comment":"获取列表中指定索引的值","isStatic":false,"return":"string | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"index":{"comment":"索引值","type":"int","options":[]}}},"getrange":{"access":"public","comment":"获取一个键值的子字符串","isStatic":false,"return":"string:","example":"\n
\n$redis->set('key', 'string value');\n$redis->getRange('key', 0, 5);   \/\/ 'string'\n$redis->getRange('key', -5, -1); \/\/ 'value'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"开始位置","type":"int","options":[]},"end":{"comment":"结束位置","type":"int","options":[]}}},"ltrim":{"access":"public","comment":"删除指定范围外的其他元素","isStatic":false,"return":"array | boolean","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"开始索引","type":"int","options":[]},"end":{"comment":"结束索引","type":"int","options":[]}}},"lrange":{"access":"public","comment":"获取列表指定范围的值","isStatic":false,"return":"array","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"int","options":[]},"end":{"comment":"索引结束值","type":"int","options":[]}}},"zremrangebyrank":{"access":"public","comment":"根据排序范围删除成员","isStatic":false,"return":"int","example":"\n
\n$redis->zAdd('key', 1, 'one');\n$redis->zAdd('key', 2, 'two');\n$redis->zAdd('key', 3, 'three');\n$redis->zRemRangeByRank('key', 0, 1); \/\/ 2\n$redis->zRange('key', 0, -1, array('withscores' => TRUE)); \/\/ array('three' => 3)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"开始排序值","type":"double","options":[]},"end":{"comment":"结束排序值","type":"double","options":[]}}},"publish":{"access":"public","comment":"将消息发布到消息通道(队列).","isStatic":false,"return":"int","example":"$redis->publish('chan-1', 'hello, world!'); \/\/ send message.","parameters":{"channel":{"comment":"消息频道","type":"string","options":[]},"message":{"comment":"消息","type":"string","options":[]}}},"rename":{"access":"public","comment":"给键重命名","isStatic":false,"return":"boolean","example":"","parameters":{"srcKey":{"comment":"旧键名","type":"string","options":[]},"dstKey":{"comment":"新键名","type":"string","options":[]}}},"renamenx":{"access":"public","comment":"当目标键名不存在时,给键重命名","isStatic":false,"return":"boolean","example":"","parameters":{"srcKey":{"comment":"旧键名","type":"string","options":[]},"dstKey":{"comment":"新键名","type":"string","options":[]}}},"pfadd":{"access":"public","comment":"将所有元素参数添加到 HyperLogLog 数据结构中","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"键名","type":"string","options":[]},"element":{"comment":"元素","type":"string|array|...","options":[]}}},"pfcount":{"access":"public","comment":"返回给定 HyperLogLog 的基数估算值","isStatic":false,"return":"","example":"","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"pfmerge":{"access":"public","comment":"将多个 HyperLogLog 合并为一个 HyperLogLog ,合并后的 HyperLogLog 的基数估算值是通过对所有 给定 HyperLogLog 进行并集计算得出的","isStatic":false,"return":"","example":"","parameters":{"dstKey":{"comment":"目标键名","type":"string|array","options":[]},"sourceKeys":{"comment":"源键名","type":"string|array","options":[]}}},"setrange":{"access":"public","comment":"修改某个键的某个位置的值","isStatic":false,"return":"string","example":"\n
\n$redis->set('key', 'Hello world');\n$redis->setRange('key', 6, \"redis\"); \/\/ returns 11\n$redis->get('key');                  \/\/ \"Hello redis\"\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"offset":{"comment":"开始位置","type":"int","options":[]},"value":{"comment":"被替换的子串的值","type":"string","options":[]}}},"restore":{"access":"public","comment":"将dump导出的二进制数据恢复到可读的字符串.","isStatic":false,"return":"","example":"\n
\n$redis->set('foo', 'bar');\n$val = $redis->dump('foo');\n$redis->restore('bar', 0, $val); \/\/ The key 'bar', will now be equal to the key 'foo'\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"ttl":{"comment":"有效期","type":"int","options":[]},"value":{"comment":"dump导出的二进制数据","type":"string","options":[]}}},"smove":{"access":"public","comment":"将某个集合中的元素移动到另外一个集合中","isStatic":false,"return":"bool","example":"\n
\n$redis->sAdd('key1' , 'set11');\n$redis->sAdd('key1' , 'set12');\n$redis->sAdd('key1' , 'set13');          \/\/ 'key1' => {'set11', 'set12', 'set13'}\n$redis->sAdd('key2' , 'set21');\n$redis->sAdd('key2' , 'set22');          \/\/ 'key2' => {'set21', 'set22'}\n$redis->sMove('key1', 'key2', 'set13');  \/\/ 'key1' =>  {'set11', 'set12'}\n\/\/ 'key2' =>  {'set21', 'set22', 'set13'}\n<\/pre>","parameters":{"srcKey":{"comment":"原集合键名","type":"string","options":[]},"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"member":{"comment":"成员","type":"string","options":[]}}},"zRange":{"access":"public","comment":"获取有序集合中指定范围的成员","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key1', 0, 'val0');\n$redis->zAdd('key1', 2, 'val2');\n$redis->zAdd('key1', 10, 'val10');\n$redis->zRange('key1', 0, -1); \/\/ array('val0', 'val2', 'val10')\n\/\/ with scores\n$redis->zRange('key1', 0, -1, true); \/\/ array('val0' => 0, 'val2' => 2, 'val10' => 10)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"withScores":{"comment":"是否返回成员的排序值","type":"boolean","options":[]}}},"zRevRange":{"access":"public","comment":"获取有序集合中指定范围的成员(倒序排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRevRange('key', 0, -1); \/\/ array('val10', 'val2', 'val0')\n\/\/ with scores\n$redis->zRevRange('key', 0, -1, true); \/\/ array('val10' => 10, 'val2' => 2, 'val0' => 0)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"withScores":{"comment":"是否返回成员的排序值","type":"boolean","options":[]}}},"zRangeByScore":{"access":"public","comment":"获取有序集合中指定范围的成员(按排序值排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRangeByScore('key', 0, 3);                                          \/\/ array('val0', 'val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              \/\/ array('val0' => 0, 'val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  \/\/ array('val2' => 2)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"options":{"comment":"附加选项(可以是:withscores => TRUE, and limit => array($offset, $count))","type":"array","options":[]}}},"zRevRangeByScore":{"access":"public","comment":"获取有序集合中指定范围的成员(按排序值倒序排列)","isStatic":false,"return":"array","example":"\n
\n$redis->zAdd('key', 0, 'val0');\n$redis->zAdd('key', 2, 'val2');\n$redis->zAdd('key', 10, 'val10');\n$redis->zRangeByScore('key', 0, 3);                                          \/\/ array('val0', 'val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              \/\/ array('val0' => 0, 'val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2' => 2)\n$redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        \/\/ array('val2')\n$redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  \/\/ array('val2' => 2)\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"start":{"comment":"索引开始值","type":"long","options":[]},"end":{"comment":"索引结束值","type":"long","options":[]},"options":{"comment":"附加选项(可以是:withscores => TRUE, and limit => array($offset, $count))","type":"array","options":[]}}},"zRangeByLex":{"access":"public","comment":"按字母字典的顺序返回成员","isStatic":false,"return":"array","example":"\n
\nforeach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {\n$redis->zAdd('key', $char);\n}\n$redis->zRangeByLex('key', '-', '[c'); \/\/ array('a', 'b', 'c')\n$redis->zRangeByLex('key', '-', '(c'); \/\/ array('a', 'b')\n$redis->zRangeByLex('key', '-', '[c'); \/\/ array('b', 'c')\n<\/pre>","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]},"offset":{"comment":"索引开始值","type":"long","options":[]},"limit":{"comment":"成员数","type":"long","options":[]}}},"zRevRangeByLex":{"access":"public","comment":"按字母字典的顺序返回成员(倒序排序)","isStatic":false,"return":"","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]},"offset":{"comment":"索引开始值","type":"long","options":[]},"limit":{"comment":"成员数","type":"long","options":[]}}},"zlexcount":{"access":"public","comment":"获取指定字母范围的成员数","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]}}},"zremrangebylex":{"access":"public","comment":"删除指定字母范围的成员","isStatic":false,"return":"long","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"min":{"comment":"最小的字母","type":"long","options":[]},"max":{"comment":"最大的字母","type":"long","options":[]}}},"zunionstore":{"access":"public","comment":"将两个有序集合的并集存入到一个指定的键中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('k1');\n$redis->delete('k2');\n$redis->delete('k3');\n$redis->delete('ko1');\n$redis->delete('ko2');\n$redis->delete('ko3');\n$redis->zAdd('k1', 0, 'val0');\n$redis->zAdd('k1', 1, 'val1');\n$redis->zAdd('k2', 2, 'val2');\n$redis->zAdd('k2', 3, 'val3');\n$redis->zUnion('ko1', array('k1', 'k2')); \/\/ 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')\n\/\/ Weighted zUnion\n$redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); \/\/ 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')\n$redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); \/\/ 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')\n<\/pre>","parameters":{"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"zsetKeys":{"comment":"集合键名","type":"array","options":[]},"zsetKeysWeight":{"comment":"集合键对应的权重","type":"array","options":[]},"aggregateFunction":{"comment":"合并使用的函数(SUM, MIN, 或 MAX)","type":"string","options":[]}}},"zinterstore":{"access":"public","comment":"将两个有序集合的交集存入到一个指定的键中","isStatic":false,"return":"int","example":"\n
\n$redis->delete('k1');\n$redis->delete('k2');\n$redis->delete('k3');\n$redis->delete('ko1');\n$redis->delete('ko2');\n$redis->delete('ko3');\n$redis->delete('ko4');\n$redis->zAdd('k1', 0, 'val0');\n$redis->zAdd('k1', 1, 'val1');\n$redis->zAdd('k1', 3, 'val3');\n$redis->zAdd('k2', 2, 'val1');\n$redis->zAdd('k2', 3, 'val3');\n$redis->zInter('ko1', array('k1', 'k2'));               \/\/ 2, 'ko1' => array('val1', 'val3')\n$redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  \/\/ 2, 'ko2' => array('val1', 'val3')\n\/\/ Weighted zInter\n$redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); \/\/ 2, 'ko3' => array('val1', 'val3')\n$redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); \/\/ 2, 'ko4' => array('val3', 'val1')\n<\/pre>","parameters":{"dstKey":{"comment":"目标集合键名","type":"string","options":[]},"zsetKeys":{"comment":"集合键名","type":"array","options":[]},"zsetKeysWeight":{"comment":"集合键对应的权重","type":"array","options":[]},"aggregateFunction":{"comment":"合并使用的函数(SUM, MIN, 或 MAX)","type":"string","options":[]}}},"zrem":{"access":"public","comment":"删除有序集合中的某个成员","isStatic":false,"return":"int","example":"","parameters":{"key":{"comment":"集合键名","type":"string","options":[]},"member":{"comment":"成员值","type":"string","options":[]}}},"sort":{"access":"public","comment":"给列表、集合或有序集合的元素排序","isStatic":false,"return":"An","example":"\n
\n$redis->delete('s');\n$redis->sadd('s', 5);\n$redis->sadd('s', 4);\n$redis->sadd('s', 2);\n$redis->sadd('s', 1);\n$redis->sadd('s', 3);\nvar_dump($redis->sort('s')); \/\/ 1,2,3,4,5\nvar_dump($redis->sort('s', array('sort' => 'desc'))); \/\/ 5,4,3,2,1\nvar_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); \/\/ (int)5\n<\/pre>","parameters":{"key":{"comment":"键名","type":"string","options":[]},"options":{"comment":"排序参数,如:array('sort' => 'desc')","type":"array","options":[]}}},"object":{"access":"public","comment":"获取某个键的对象信息","isStatic":false,"return":"string","example":"\n
\n$redis->object(\"encoding\", \"l\"); \/\/ → ziplist\n$redis->object(\"refcount\", \"l\"); \/\/ → 1\n$redis->object(\"idletime\", \"l\"); \/\/ → 400 (in seconds, with a precision of 10 seconds).\n<\/pre>","parameters":{"info":{"comment":"获取的信息指标名称(有 encoding、refcount 、idletime 3种可选择)","type":"string","options":[]},"key":{"comment":"键名","type":"string","options":[]}}},"subscribe":{"access":"public","comment":"订阅消息","isStatic":false,"return":"mixed","example":"\n
\nfunction f($redis, $chan, $msg) {\nswitch($chan) {\ncase 'chan-1':\n...\nbreak;\ncase 'chan-2':\n...\nbreak;\ncase 'chan-2':\n...\nbreak;\n}\n}\n$redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); \/\/ subscribe to 3 chans\n<\/pre>","parameters":{"channels":{"comment":"订阅的消息频道","type":"array","options":[]},"callback":{"comment":"回调函数名称","type":"string|array","options":[]},"value":{"comment":"返回值","type":"mixed","options":[]}}},"psubscribe":{"access":"public","comment":"通过匹配模式来订阅这些匹配的消息频道","isStatic":false,"return":"","example":"\n
\nfunction psubscribe($redis, $pattern, $chan, $msg) {\necho \"Pattern: $pattern\\n\";\necho \"Channel: $chan\\n\";\necho \"Payload: $msg\\n\";\n}\n<\/pre>","parameters":{"patterns":{"comment":"匹配模式","type":"array","options":[]},"callback":{"comment":"回调函数名称","type":"string|array","options":[]},"value":{"comment":"返回值","type":"mixed","options":[]}}},"unsubscribe":{"access":"public","comment":"取消订阅","isStatic":false,"return":"","example":"","parameters":{"channels":{"comment":"订阅的消息频道","type":"array","options":[]}}},"punsubscribe":{"access":"public","comment":"通过匹配模式来取消订阅这些匹配的消息频道","isStatic":false,"return":"","example":"","parameters":{"patterns":{"comment":"匹配模式","type":"array","options":[]}}},"eval":{"access":"public","comment":"执行lua脚本","isStatic":false,"return":"mixed","example":"","parameters":{"script":{"comment":"脚本","type":"string","options":[]},"args":{"comment":"脚本参数","type":"array","options":[]},"num_keys":{"comment":"应该进入KEYS数组的参数个数","type":"int","options":[]}}},"evalsha":{"access":"public","comment":"从脚本的SHA1散列而不是脚本本身执行LUA脚本","isStatic":false,"return":"","example":"$script = 'return 1';\n$sha = $redis->script('load', $script);\n$redis->evalSha($sha); \/\/ Returns 1","parameters":{"script_sha":{"comment":"脚本的散列值","type":"string","options":[]},"args":{"comment":"脚本参数","type":"array","options":[]},"num_keys":{"comment":"应该进入KEYS数组的参数个数","type":"int","options":[]}}},"scan":{"access":"public","comment":"扫描键空间.","isStatic":false,"return":"array","example":"\n
\n$iterator = null;\nwhile($keys = $redis->scan($iterator)) {\nforeach($keys as $key) {\necho $key . PHP_EOL;\n}\n}\n<\/pre>","parameters":{"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"hscan":{"access":"public","comment":"扫描hash的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"zscan":{"access":"public","comment":"扫描有序集合的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"sscan":{"access":"public","comment":"扫描集合的键","isStatic":false,"return":"","example":"","parameters":{"str_key":{"comment":"键值","type":"string","options":[]},"i_iterator":{"comment":"迭代器","type":"Long|NULL","options":[]},"str_pattern":{"comment":"匹配的模式","type":"string","options":[]},"i_count":{"comment":"每次迭代的长度","type":"int","options":[]}}},"getmode":{"access":"public","comment":"获取运行模式,如 ATOMIC\/MULTI\/PIPELINE","isStatic":false,"return":"int","example":"$redis->getMode();","parameters":[]},"getLastError":{"access":"public","comment":"获取上次错误信息","isStatic":false,"return":"string","example":"\n
\n$redis->eval('this-is-not-lua');\n$err = $redis->getLastError();\n\/\/ \"ERR Error compiling script (new function): user_script:1: '=' expected near '-'\"\n<\/pre>","parameters":[]},"clearLastError":{"access":"public","comment":"清除上次错误信息","isStatic":false,"return":"bool","example":"\n
\n$redis->set('x', 'a');\n$redis->incr('x');\n$err = $redis->getLastError();\n\/\/ \"ERR value is not an integer or out of range\"\n$redis->clearLastError();\n$err = $redis->getLastError();\n\/\/ NULL\n<\/pre>","parameters":[]},"getOption":{"access":"public","comment":"获取客户端选项","isStatic":false,"return":"int","example":"\n\/\/ return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY.\n$redis->getOption(Redis::OPT_SERIALIZER);","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]}}},"setOption":{"access":"public","comment":"设置客户端选项.","isStatic":false,"return":"bool:","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        \/\/ don't serialize data\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         \/\/ use built-in serialize\/unserialize\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    \/\/ use igBinary serialize\/unserialize\n$redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      \/\/ use custom prefix on all keys\n<\/pre>","parameters":{"optionName":{"comment":"选项名","type":"string","options":[]},"optionValue":{"comment":"选项值","type":"string","options":[]}}},"_prefix":{"access":"public","comment":"设置键前缀","isStatic":false,"return":"string","example":"\n
\n$redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');\n$redis->_prefix('my-value'); \/\/ Will return 'my-prefix:my-value'\n<\/pre>","parameters":{"prefix":{"comment":"前缀","type":"string","options":[]}}},"_serialize":{"access":"public","comment":"用于手动序列化.","isStatic":false,"return":"","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);\n$redis->_serialize(\"foo\"); \/\/ returns \"foo\"\n$redis->_serialize(Array()); \/\/ Returns \"Array\"\n$redis->_serialize(new stdClass()); \/\/ Returns \"Object\"\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);\n$redis->_serialize(\"foo\"); \/\/ Returns 's:3:\"foo\";'\n<\/pre>","parameters":{"value":{"comment":"被序列化的值","type":"string","options":[]}}},"_unserialize":{"access":"public","comment":"反序列化方法.","isStatic":false,"return":"","example":"\n
\n$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);\n$redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); \/\/ Will return Array(1,2,3)\n<\/pre>","parameters":{"value":{"comment":"被反序列化的值","type":"string","options":[]}}},"_masters":{"access":"public","comment":"获取集群中的主服务器列表","isStatic":false,"return":"array","example":"foreach ($obj_cluster->_masters() as $arr_master) {\n$obj_cluster->echo($arr_master, \"Hello: \" . implode(':', $arr_master));\n}","parameters":[]},"_redir":{"access":"public","comment":"获取跳转的地址,格式为:host:port","isStatic":false,"return":"string|NULL","example":"","parameters":[]},"multi":{"access":"public","comment":"开始一个事务.","isStatic":false,"return":"","example":"\n
\n$ret = $redis->multi()\n->set('key1', 'val1')\n->get('key1')\n->set('key2', 'val2')\n->get('key2')\n->exec();\n\/\/$ret == array (\n\/\/    0 => TRUE,\n\/\/    1 => 'val1',\n\/\/    2 => TRUE,\n\/\/    3 => 'val2');\n<\/pre>","parameters":[]},"discard":{"access":"public","comment":"取消事务","isStatic":false,"return":"","example":"","parameters":[]},"exec":{"access":"public","comment":"执行事务","isStatic":false,"return":"","example":"","parameters":[]},"watch":{"access":"public","comment":"观察某个键在其他客户端的变化情况.","isStatic":false,"return":"","example":"\n
\n$redis->watch('x');\n\/\/ long code here during the execution of which other clients could well modify `x`\n$ret = $redis->multi()\n->incr('x')\n->exec();\n\/\/ $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.\n<\/pre>","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"unwatch":{"access":"public","comment":"取消观察某个键在其他客户端的变化情况","isStatic":false,"return":"","example":"","parameters":{"keys":{"comment":"键名","type":"string|array","options":[]}}},"save":{"access":"public","comment":"将数据同步到硬盘上","isStatic":false,"return":"boolean","example":"$redis->save();","parameters":[]},"bgSave":{"access":"public","comment":"将数据存入到硬盘上(异步操作)","isStatic":false,"return":"","example":"","parameters":[]},"flushdb":{"access":"public","comment":"删除当前数据库的所有键","isStatic":false,"return":"bool","example":"$redis->flushDB();","parameters":[]},"flushall":{"access":"public","comment":"删除当前实例的所有键","isStatic":false,"return":"bool","example":"$redis->flushAll();","parameters":[]},"dbsize":{"access":"public","comment":"获取当前数据库的键的个数","isStatic":false,"return":"int","example":"\n
\n$count = $redis->dbSize();\necho \"Redis has $count keys\\n\";\n<\/pre>","parameters":[]},"bgrewriteaof":{"access":"public","comment":"开启后台写AOF日志操作","isStatic":false,"return":"bool","example":"$redis->bgrewriteaof();","parameters":[]},"lastsave":{"access":"public","comment":"获取上次数据同步到硬盘的时间","isStatic":false,"return":"int","example":"$redis->lastSave();","parameters":[]},"info":{"access":"public","comment":"获取Redis服务器的信息和统计数据","isStatic":false,"return":"array","example":"\n
\n$redis->info();\nor\n$redis->info(\"COMMANDSTATS\"); \/\/Information on the commands that have been run (>=2.6 only)\n$redis->info(\"CPU\"); \/\/ just CPU information from Redis INFO\n<\/pre>","parameters":[]},"role":{"access":"public","comment":"返回当前连接的服务器的角色,如master、alone、slave、sentinel","isStatic":false,"return":"string","example":"","parameters":[]},"time":{"access":"public","comment":"返回当前redis服务器时间.","isStatic":false,"return":"int","example":"\n
\nvar_dump( $redis->time() );\n\/\/ array(2) {\n\/\/   [0] => string(10) \"1342364352\"\n\/\/   [1] => string(6) \"253002\"\n\/\/ }\n<\/pre>","parameters":[]},"randomkey":{"access":"public","comment":"返回一个随机的键","isStatic":false,"return":"string","example":"\n
\n$key = $redis->randomKey();\n$surprise = $redis->get($key);  \/\/ who knows what's in there.\n<\/pre>","parameters":[]},"ping":{"access":"public","comment":"检查当前redis连接状态(成功时返回PONG)","isStatic":false,"return":"string","example":"","parameters":[]},"echo":{"access":"public","comment":"向redis发送一个字符串,而且redis服务器将返回一个相同的字符串","isStatic":false,"return":"string","example":"","parameters":{"str":{"comment":"发送的字符串","type":"string","options":[]}}},"command":{"access":"public","comment":"获取所有命令列表","isStatic":false,"return":"array","example":"","parameters":[]},"rawcommand":{"access":"public","comment":"在redis服务器上执行命令","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"执行的命令","type":"string","options":[]},"args":{"comment":"参数","type":"string|array","options":[]}}},"cluster":{"access":"public","comment":"获取集群节点信息","isStatic":false,"return":"array","example":"","parameters":{"args":{"comment":"参数(目前只支持slots)","type":"string","options":[]}}},"client":{"access":"public","comment":"获取客户端相关参数或进行相关操作","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"命令(CLIENT LIST\nCLIENT GETNAME\nCLIENT SETNAME [name]\nCLIENT KILL [ip:port]\n)","type":"string","options":[]},"args":{"comment":"参数","type":"string","options":[]}}},"config":{"access":"public","comment":"获取或设置配置项.","isStatic":false,"return":"array","example":"\n
\n$redis->config(\"GET\", \"*max-*-entries*\");\n$redis->config(\"SET\", \"dir\", \"\/var\/run\/redis\/dumps\/\");\n<\/pre>","parameters":{"operation":{"comment":"操作(SET或GET)","type":"string","options":[]},"key":{"comment":"配置项或配置项匹配模式","type":"string","options":[]},"value":{"comment":"配置值","type":"string","options":[]}}},"pubsub":{"access":"public","comment":"查看订阅与发布系统状态,它由数个不同格式的子命令组成.","isStatic":false,"return":"array|int","example":"\n
\n$redis->pubsub('channels'); \/\/ All channels\n$redis->pubsub('channels', '*pattern*'); \/\/ Just channels matching your pattern\n$redis->pubsub('numsub', array('chan1', 'chan2')); \/\/ Get subscriber counts for 'chan1' and 'chan2'\n$redis->pubsub('numpat'); \/\/ Get the number of pattern subscribers\n<\/pre>","parameters":{"subcommand":{"comment":"子命令(可以是channels, numsub, numpat)","type":"string","options":[]},"args":{"comment":"参数","type":"string|array","options":[]}}},"script":{"access":"public","comment":"在脚本子系统上执行redis命令","isStatic":false,"return":"","example":"\n
\n$redis->script('load', $script);\n$redis->script('flush');\n$redis->script('kill');\n$redis->script('exists', $script1, [$script2, $script3, ...]);\n<\/pre>\nSCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure.\nSCRIPT FLUSH should always return TRUE\nSCRIPT KILL will return true if a script was able to be killed and false if not\nSCRIPT EXISTS will return an array with TRUE or FALSE for each passed script","parameters":{"command":{"comment":"redis命令","type":"string","options":[]},"script":{"comment":"脚本","type":"string|...","options":[]}}},"slowlog":{"access":"public","comment":"获取慢操作日志","isStatic":false,"return":"","example":"","parameters":{"command":{"comment":"执行的命令","type":"string","options":[]},"length":{"comment":"获取条目数","type":"int","options":[]}}}}}
\ No newline at end of file
diff --git a/data/dict/redis/redisclusterexception.json b/data/dict/redis/redisclusterexception.json
index 998d8ab..40e98f7 100644
--- a/data/dict/redis/redisclusterexception.json
+++ b/data/dict/redis/redisclusterexception.json
@@ -1 +1 @@
-{"object":{"name":"RedisClusterException"},"comment":"redis 集群异常类","namespace":"","extends":"RuntimeException","consts":[],"properties":{"message":{"access":"protected","type":"string","comment":"异常错误信息","isStatic":false,"value":""},"code":{"access":"protected","type":"int","comment":"异常错误码","isStatic":false,"value":0},"file":{"access":"protected","type":"string","comment":"错误文件位置","isStatic":false},"line":{"access":"protected","type":"int","comment":"错误文件行数","isStatic":false}},"methods":{"__clone":{"access":"private","isFinal":1,"comment":"克隆魔术方法(这里禁止克隆)","isStatic":false,"return":"","example":"","parameters":[]},"__construct":{"access":"public","comment":"异常初始化","isStatic":false,"return":"","example":"","parameters":{"message":{"comment":"异常提示信息","type":"string","options":[]},"code":{"comment":"异常错误码","type":"int","options":[]},"previous":{"comment":"异常链中的前一个异常","type":"Throwable","options":[]}}},"__wakeup":{"access":"public","comment":"反序列化函数调用的魔术方法(unserialize() 从字节流中创建了一个对象之后,马上检查是否具有__wakeup 的函数的存在。如果存在,__wakeup 立刻被调用。使用 __wakeup 的目的是重建在序列化中可能丢失的任何数据库连接以及处理其它重新初始化的任务)","isStatic":false,"return":"","example":"","parameters":[]},"getMessage":{"access":"public","isFinal":1,"comment":"获取异常提示信息","isStatic":false,"return":"string","example":"","parameters":[]},"getCode":{"access":"public","isFinal":1,"comment":"获取异常代码","isStatic":false,"return":"int","example":"","parameters":[]},"getFile":{"access":"public","isFinal":1,"comment":"创建异常时的程序文件名称","isStatic":false,"return":"string","example":"","parameters":[]},"getLine":{"access":"public","isFinal":1,"comment":"获取创建的异常所在文件中的行号","isStatic":false,"return":"int","example":"","parameters":[]},"getTrace":{"access":"public","isFinal":1,"comment":"获取异常追踪信息","isStatic":false,"return":"array","example":"","parameters":[]},"getPrevious":{"access":"public","isFinal":1,"comment":"返回异常链中的前一个异常","isStatic":false,"return":"Throwable","example":"","parameters":[]},"getTraceAsString":{"access":"public","isFinal":1,"comment":"获取字符串类型的异常追踪信息","isStatic":false,"return":"string","example":"","parameters":[]},"__toString":{"access":"public","comment":"将异常信息转化为字符串","isStatic":false,"return":"","example":"","parameters":[]}}}
\ No newline at end of file
+{"object":{"name":"RedisClusterException"},"comment":"redis 集群异常类","namespace":"","extends":"Exception","interfaces":["Throwable"],"consts":[],"properties":{"message":{"access":"protected","type":"string","comment":"异常错误信息","isStatic":false,"value":""},"code":{"access":"protected","type":"int","comment":"异常错误码","isStatic":false,"value":0},"file":{"access":"protected","type":"string","comment":"错误文件位置","isStatic":false},"line":{"access":"protected","type":"int","comment":"错误文件行数","isStatic":false}},"methods":{"__clone":{"access":"private","isFinal":1,"comment":"克隆魔术方法(这里禁止克隆)","isStatic":false,"return":"","example":"","parameters":[]},"__construct":{"access":"public","comment":"异常初始化","isStatic":false,"return":"","example":"","parameters":{"message":{"comment":"异常提示信息","type":"string","options":[]},"code":{"comment":"异常错误码","type":"int","options":[]},"previous":{"comment":"异常链中的前一个异常","type":"Throwable","options":[]}}},"__wakeup":{"access":"public","comment":"反序列化函数调用的魔术方法(unserialize() 从字节流中创建了一个对象之后,马上检查是否具有__wakeup 的函数的存在。如果存在,__wakeup 立刻被调用。使用 __wakeup 的目的是重建在序列化中可能丢失的任何数据库连接以及处理其它重新初始化的任务)","isStatic":false,"return":"","example":"","parameters":[]},"getMessage":{"access":"public","isFinal":1,"comment":"获取异常提示信息","isStatic":false,"return":"string","example":"","parameters":[]},"getCode":{"access":"public","isFinal":1,"comment":"获取异常代码","isStatic":false,"return":"int","example":"","parameters":[]},"getFile":{"access":"public","isFinal":1,"comment":"创建异常时的程序文件名称","isStatic":false,"return":"string","example":"","parameters":[]},"getLine":{"access":"public","isFinal":1,"comment":"获取创建的异常所在文件中的行号","isStatic":false,"return":"int","example":"","parameters":[]},"getTrace":{"access":"public","isFinal":1,"comment":"获取异常追踪信息","isStatic":false,"return":"array","example":"","parameters":[]},"getPrevious":{"access":"public","isFinal":1,"comment":"返回异常链中的前一个异常","isStatic":false,"return":"Throwable","example":"","parameters":[]},"getTraceAsString":{"access":"public","isFinal":1,"comment":"获取字符串类型的异常追踪信息","isStatic":false,"return":"string","example":"","parameters":[]},"__toString":{"access":"public","comment":"将异常信息转化为字符串","isStatic":false,"return":"","example":"","parameters":[]}}}
\ No newline at end of file
diff --git a/data/dict/redis/redisexception.json b/data/dict/redis/redisexception.json
index dc49a10..ebce8eb 100644
--- a/data/dict/redis/redisexception.json
+++ b/data/dict/redis/redisexception.json
@@ -1,151 +1 @@
-{
-  "object": {
-    "name": "RedisException"
-  },
-  "comment": "redis 异常类",
-  "namespace": "",
-  "extends": "RuntimeException",
-  "consts": [],
-  "properties": {
-    "message": {
-      "access": "protected",
-      "type": "string",
-      "comment": "异常错误信息",
-      "isStatic": false,
-      "value": ""
-    },
-    "code": {
-      "access": "protected",
-      "type": "int",
-      "comment": "异常错误码",
-      "isStatic": false,
-      "value": 0
-    },
-    "file": {
-      "access": "protected",
-      "type": "string",
-      "comment": "错误文件位置",
-      "isStatic": false
-    },
-    "line": {
-      "access": "protected",
-      "type": "int",
-      "comment": "错误文件行数",
-      "isStatic": false
-    }
-  },
-  "methods": {
-    "__clone": {
-      "access": "private",
-      "isFinal": 1,
-      "comment": "克隆魔术方法(这里禁止克隆)",
-      "isStatic": false,
-      "return": "",
-      "example": "",
-      "parameters": []
-    },
-    "__construct": {
-      "access": "public",
-      "comment": "异常初始化",
-      "isStatic": false,
-      "return": "",
-      "example": "",
-      "parameters": {
-        "message": {
-          "comment": "异常提示信息",
-          "type": "string",
-          "options": []
-        },
-        "code": {
-          "comment": "异常错误码",
-          "type": "int",
-          "options": []
-        },
-        "previous": {
-          "comment": "异常链中的前一个异常",
-          "type": "Throwable",
-          "options": []
-        }
-      }
-    },
-    "__wakeup": {
-      "access": "public",
-      "comment": "反序列化函数调用的魔术方法(unserialize() 从字节流中创建了一个对象之后,马上检查是否具有__wakeup 的函数的存在。如果存在,__wakeup 立刻被调用。使用 __wakeup 的目的是重建在序列化中可能丢失的任何数据库连接以及处理其它重新初始化的任务)",
-      "isStatic": false,
-      "return": "",
-      "example": "",
-      "parameters": []
-    },
-    "getMessage": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "获取异常提示信息",
-      "isStatic": false,
-      "return": "string",
-      "example": "",
-      "parameters": []
-    },
-    "getCode": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "获取异常代码",
-      "isStatic": false,
-      "return": "int",
-      "example": "",
-      "parameters": []
-    },
-    "getFile": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "创建异常时的程序文件名称",
-      "isStatic": false,
-      "return": "string",
-      "example": "",
-      "parameters": []
-    },
-    "getLine": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "获取创建的异常所在文件中的行号",
-      "isStatic": false,
-      "return": "int",
-      "example": "",
-      "parameters": []
-    },
-    "getTrace": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "获取异常追踪信息",
-      "isStatic": false,
-      "return": "array",
-      "example": "",
-      "parameters": []
-    },
-    "getPrevious": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "返回异常链中的前一个异常",
-      "isStatic": false,
-      "return": "Throwable",
-      "example": "",
-      "parameters": []
-    },
-    "getTraceAsString": {
-      "access": "public",
-      "isFinal": 1,
-      "comment": "获取字符串类型的异常追踪信息",
-      "isStatic": false,
-      "return": "string",
-      "example": "",
-      "parameters": []
-    },
-    "__toString": {
-      "access": "public",
-      "comment": "将异常信息转化为字符串",
-      "isStatic": false,
-      "return": "",
-      "example": "",
-      "parameters": []
-    }
-  }
-}
\ No newline at end of file
+{"object":{"name":"RedisException"},"comment":"redis 异常类","namespace":"","extends":"Exception","interfaces":["Throwable"],"consts":[],"properties":{"message":{"access":"protected","type":"string","comment":"异常错误信息","isStatic":false,"value":""},"code":{"access":"protected","type":"int","comment":"异常错误码","isStatic":false,"value":0},"file":{"access":"protected","type":"string","comment":"错误文件位置","isStatic":false},"line":{"access":"protected","type":"int","comment":"错误文件行数","isStatic":false}},"methods":{"__clone":{"access":"private","isFinal":1,"comment":"克隆魔术方法(这里禁止克隆)","isStatic":false,"return":"","example":"","parameters":[]},"__construct":{"access":"public","comment":"异常初始化","isStatic":false,"return":"","example":"","parameters":{"message":{"comment":"异常提示信息","type":"string","options":[]},"code":{"comment":"异常错误码","type":"int","options":[]},"previous":{"comment":"异常链中的前一个异常","type":"Throwable","options":[]}}},"__wakeup":{"access":"public","comment":"反序列化函数调用的魔术方法(unserialize() 从字节流中创建了一个对象之后,马上检查是否具有__wakeup 的函数的存在。如果存在,__wakeup 立刻被调用。使用 __wakeup 的目的是重建在序列化中可能丢失的任何数据库连接以及处理其它重新初始化的任务)","isStatic":false,"return":"","example":"","parameters":[]},"getMessage":{"access":"public","isFinal":1,"comment":"获取异常提示信息","isStatic":false,"return":"string","example":"","parameters":[]},"getCode":{"access":"public","isFinal":1,"comment":"获取异常代码","isStatic":false,"return":"int","example":"","parameters":[]},"getFile":{"access":"public","isFinal":1,"comment":"创建异常时的程序文件名称","isStatic":false,"return":"string","example":"","parameters":[]},"getLine":{"access":"public","isFinal":1,"comment":"获取创建的异常所在文件中的行号","isStatic":false,"return":"int","example":"","parameters":[]},"getTrace":{"access":"public","isFinal":1,"comment":"获取异常追踪信息","isStatic":false,"return":"array","example":"","parameters":[]},"getPrevious":{"access":"public","isFinal":1,"comment":"返回异常链中的前一个异常","isStatic":false,"return":"Throwable","example":"","parameters":[]},"getTraceAsString":{"access":"public","isFinal":1,"comment":"获取字符串类型的异常追踪信息","isStatic":false,"return":"string","example":"","parameters":[]},"__toString":{"access":"public","comment":"将异常信息转化为字符串","isStatic":false,"return":"","example":"","parameters":[]}}}
\ No newline at end of file
diff --git a/data/output/Redis/Redis.php b/data/output/Redis/Redis.php
new file mode 100644
index 0000000..501bedd
--- /dev/null
+++ b/data/output/Redis/Redis.php
@@ -0,0 +1,3832 @@
+
+     * $redis->connect('127.0.0.1', 6379);
+     * $redis->connect('127.0.0.1');            // port 6379 by default
+     * $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
+     * $redis->connect('/tmp/redis.sock');      // unix domain socket.
+     * 
+ * @param string $host 主机IP + * @param int $port 端口 + * @param float $timeout 连接超时时间(以秒为单位) + * @param mixed $reserved 当使用retry_interval时该值为NULL + * @param int $retry_interval 重试间隔 + * @param float $read_timeout 读操作超时时间 + * @return bool + */ + public function connect(string $host, int $port, float $timeout, $reserved, int $retry_interval, float $read_timeout): bool + { + + } + + /** + * + *连接redis(长连接),与connect用法一致 + * @example + *
+     * $redis->pconnect('127.0.0.1', 6379);
+     * $redis->pconnect('127.0.0.1');            // port 6379 by default
+     * $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
+     * $redis->connect('/tmp/redis.sock');      // unix domain socket.
+     * 
+ * @param string $host 主机IP + * @param int $port 端口 + * @param float $timeout 连接超时时间(以秒为单位) + * @param mixed $reserved 当使用retry_interval时该值为NULL + * @param int $retry_interval 重试间隔 + * @param float $read_timeout 读操作超时时间 + * @return bool + */ + public function pconnect(string $host, int $port, float $timeout, $reserved, int $retry_interval, float $read_timeout): bool + { + + } + + /** + * + *关闭redis连接(长连接除外) + * @example + * @return + */ + public function close() + { + + } + + /** + * + *检查当前redis连接状态(成功时返回PONG) + * @example + * @return string + */ + public function ping(): string + { + + } + + /** + * + *向redis发送一个字符串,而且redis服务器将返回一个相同的字符串 + * @example + * @param string $str 发送的字符串 + * @return string + */ + public function echo(string $str): string + { + + } + + /** + * + *获取指定的key的值 + * @example $redis->get('key'); + * @return string|bool + */ + public function get(): ?string + { + + } + + /** + * + *给指定的键设置值 + * @example 直接设置: + * $redis->set('key', 'value'); + * 带有效期的设置: + * $redis->set('key','value', 10); + * 当键不存在时,设置期有效期为10秒: + * $redis->set('key', 'value', Array('nx', 'ex'=>10)); + * 当键存在时,设置期有效期为1000毫秒: + * $redis->set('key', 'value', Array('xx', 'px'=>1000)); + * + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int|array $options 附加项,可以是超时时间或者一个选项数组 + * @return bool + */ + public function set(string $key, string $value, int $options): bool + { + + } + + /** + * + *设置键值并设置有效期 + * @example $redis->setex('key', 3600, 'value'); + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int $ttl 有效期 + * @return bool + */ + public function setex(string $key, string $value, int $ttl): bool + { + + } + + /** + * + *设置键值并设置有效期(毫秒为单位) + * @example + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int $ttl 有效期(毫秒为单位) + * @return + */ + public function psetex(string $key, string $value, int $ttl) + { + + } + + /** + * + *当键不存在时设置其值 + * @example + * $redis->setnx('key', 'value'); + * + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @return bool: + */ + public function setnx(string $key, string $value): bool: + { + + } + + /** + * + *设置键的值,并返回它的旧的缓存值 + * @example + *
+     * $redis->set('x', '42');
+     * $exValue = $redis->getSet('x', 'lol');   // return '42', replaces x by 'lol'
+     * $newValue = $redis->get('x')'            // return 'lol'
+     * 
+ * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @return string + */ + public function getSet(string $key, string $value): string + { + + } + + /** + * + *返回一个随机的键 + * @example + *
+     * $key = $redis->randomKey();
+     * $surprise = $redis->get($key);  // who knows what's in there.
+     * 
+ * @return string + */ + public function randomKey(): string + { + + } + + /** + * + *给键重命名 + * @example + * @param string $srcKey 旧键名 + * @param string $dstKey 新键名 + * @return boolean + */ + public function renameKey(string $srcKey, string $dstKey): boolean + { + + } + + /** + * + *当目标键名不存在时,给键重命名 + * @example + * @param string $srcKey 旧键名 + * @param string $dstKey 新键名 + * @return boolean + */ + public function renameNx(string $srcKey, string $dstKey): boolean + { + + } + + /** + * + *批量获取键值 + * @example + *
+     * $redis->set('key1', 'value1');
+     * $redis->set('key2', 'value2');
+     * $redis->set('key3', 'value3');
+     * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
+     * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
+     * 
+ * @param array $keys 键名数组 + * @return array + */ + public function getMultiple(Array $keys): array + { + + } + + /** + * + *判断键是否存在 + * @example + *
+     * $redis->set('key', 'value');
+     * $redis->exists('key');               //  TRUE
+     * $redis->exists('NonExistingKey');    // FALSE
+     * 
+ * @param string $key 键名 + * @return bool + */ + public function exists(string $key): bool + { + + } + + /** + * + *删除一个或多个键 + * @example $redis->delete('key1', 'key2'); + * $redis->delete(array('key3', 'key4')); + * @param array|string $keys 键名 + * @return int + */ + public function delete(array $keys): int + { + + } + + /** + * + *键值自增 + * @example + *
+     * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
+     * $redis->incr('key1'); // 2
+     * $redis->incr('key1'); // 3
+     * $redis->incr('key1'); // 4
+     * 
+ * @param string $key 键名 + * @return int + */ + public function incr(string $key): int + { + + } + + /** + * + *按指定步长自增 + * @example + *
+     * $redis->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
+     * $redis->incr('key1');        // 2
+     * $redis->incr('key1');        // 3
+     * $redis->incr('key1');        // 4
+     * $redis->incrBy('key1', 10);  // 14
+     * 
+ * @param string $key 键名 + * @param int $step 自增步长 + * @return int + */ + public function incrBy(string $key, int $step): int + { + + } + + /** + * + *按指定步长自增 + * @example + *
+     * $redis = new Redis();
+     * $redis->connect('127.0.0.1');
+     * $redis->set('x', 3);
+     * var_dump( $redis->incrByFloat('x', 1.5) );   // float(4.5)
+     * // ! SIC
+     * var_dump( $redis->get('x') );                // string(3) "4.5"
+     * 
+ * @param string $key 键名 + * @param float $step 自增步长 + * @return float + */ + public function incrByFloat(string $key, float $step): float + { + + } + + /** + * + *键值自减 + * @example + *
+     * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
+     * $redis->decr('key1'); // -2
+     * $redis->decr('key1'); // -3
+     * 
+ * @param string $key 键名 + * @return int + */ + public function decr(string $key): int + { + + } + + /** + * + *按指定步长自减 + * @example + *
+     * $redis->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
+     * $redis->decr('key1');        // -2
+     * $redis->decr('key1');        // -3
+     * $redis->decrBy('key1', 10);  // -13
+     * 
+ * @param string $key 键名 + * @param float $step 自减步长 + * @return int + */ + public function decrBy(string $key, float $step): int + { + + } + + /** + * + *获取指定键的数据类型(需要根据常量匹配) + * @example $redis->type('key'); + * @param string $key 键名 + * @return int + */ + public function type(string $key): int + { + + } + + /** + * + *将字符串追加到键值后(返回值的长度) + * @example + *
+     * $redis->set('key', 'value1');
+     * $redis->append('key', 'value2'); // 12
+     * $redis->get('key');              // 'value1value2'
+     * 
+ * @param string $key 键名 + * @param string $value 追加的值 + * @return int + */ + public function append(string $key, string $value): int + { + + } + + /** + * + *获取一个键值的子字符串 + * @example + *
+     * $redis->set('key', 'string value');
+     * $redis->getRange('key', 0, 5);   // 'string'
+     * $redis->getRange('key', -5, -1); // 'value'
+     * 
+ * @param string $key 键名 + * @param int $start 开始位置 + * @param int $end 结束位置 + * @return string: + */ + public function getRange(string $key, int $start, int $end): string: + { + + } + + /** + * + *修改某个键的某个位置的值 + * @example + *
+     * $redis->set('key', 'Hello world');
+     * $redis->setRange('key', 6, "redis"); // returns 11
+     * $redis->get('key');                  // "Hello redis"
+     * 
+ * @param string $key 键名 + * @param int $offset 开始位置 + * @param string $value 被替换的子串的值 + * @return string + */ + public function setRange(string $key, int $offset, string $value): string + { + + } + + /** + * + *获取某个键的某个位置的位值 + * @example + *
+     * $redis->set('key', "\x7f");  // this is 0111 1111
+     * $redis->getBit('key', 0);    // 0
+     * $redis->getBit('key', 1);    // 1
+     * 
+ * @param string $key 键名 + * @param int $offset 所在位置 + * @return int + */ + public function getBit(string $key, int $offset): int + { + + } + + /** + * + *修改某个键的某个位置的位值 + * @example + *
+     * $redis->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
+     * $redis->setBit('key', 5, 1); // returns 0
+     * $redis->setBit('key', 7, 1); // returns 0
+     * $redis->get('key');          // chr(0x2f) = "/" = b("0010 1111")
+     * 
+ * @param string $key 键名 + * @param int $offset 开始位置 + * @param boolean|int $value 新值 + * @return int + */ + public function setBit(string $key, int $offset, int $value): int + { + + } + + /** + * + *获取键值的长度 + * @example + *
+     * $redis->set('key', 'value');
+     * $redis->strlen('key'); // 5
+     * 
+ * @param string $key 键名 + * @return int + */ + public function strlen(string $key): int + { + + } + + /** + * + *根据匹配模式获取键名(如*) + * @example + * $allKeys = $redis->keys('*'); + * $keyWithUserPrefix = $redis->keys('user*'); + * @param string $pattern 匹配模式 + * @return array + */ + public function getKeys(string $pattern): array + { + + } + + /** + * + *给列表、集合或有序集合的元素排序 + * @example + *
+     * $redis->delete('s');
+     * $redis->sadd('s', 5);
+     * $redis->sadd('s', 4);
+     * $redis->sadd('s', 2);
+     * $redis->sadd('s', 1);
+     * $redis->sadd('s', 3);
+     * var_dump($redis->sort('s')); // 1,2,3,4,5
+     * var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
+     * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
+     * 
+ * @param string $key 键名 + * @param array $options 排序参数,如:array('sort' => 'desc') + * @return An + */ + public function sort(string $key, Array $options): An + { + + } + + /** + * + *给列表、集合或有序集合的元素排序(自小到大顺序) + * @example + * @param string $key 键名 + * @return + */ + public function sortAsc(string $key) + { + + } + + /** + * + *给列表、集合或有序集合的元素排序(按字母顺序) + * @example + * @param string $key 键名 + * @return + */ + public function sortAscAlpha(string $key) + { + + } + + /** + * + *给列表、集合或有序集合的元素排序(自大到小顺序) + * @example + * @param string $key 键名 + * @return + */ + public function sortDesc(string $key) + { + + } + + /** + * + *给列表、集合或有序集合的元素排序(按字母顺序倒序) + * @example + * @param string $key 键名 + * @return + */ + public function sortDescAlpha(string $key) + { + + } + + /** + * + *从左侧(头部)向列表插入元素 + * @example + *
+     * $redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
+     * var_dump( $redis->lRange('l', 0, -1) );
+     * //// Output:
+     * // array(4) {
+     * //   [0]=> string(2) "v4"
+     * //   [1]=> string(2) "v3"
+     * //   [2]=> string(2) "v2"
+     * //   [3]=> string(2) "v1"
+     * // }
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function lPush(string $key, string $value): int + { + + } + + /** + * + *从右侧(尾部)向列表插入元素 + * @example + *
+     * $redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    // int(4)
+     * var_dump( $redis->lRange('l', 0, -1) );
+     * //// Output:
+     * // array(4) {
+     * //   [0]=> string(2) "v1"
+     * //   [1]=> string(2) "v2"
+     * //   [2]=> string(2) "v3"
+     * //   [3]=> string(2) "v4"
+     * // }
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function rPush(string $key, string $value): int + { + + } + + /** + * + *如果列表存在,从左侧(头部)向列表插入元素 + * @example + *
+     * $redis->delete('key1');
+     * $redis->lPushx('key1', 'A');     // returns 0
+     * $redis->lPush('key1', 'A');      // returns 1
+     * $redis->lPushx('key1', 'B');     // returns 2
+     * $redis->lPushx('key1', 'C');     // returns 3
+     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function lPushx(string $key, string $value): int + { + + } + + /** + * + *如果列表存在,从右侧(尾部)向列表插入元素 + * @example + *
+     * $redis->delete('key1');
+     * $redis->rPushx('key1', 'A'); // returns 0
+     * $redis->rPush('key1', 'A'); // returns 1
+     * $redis->rPushx('key1', 'B'); // returns 2
+     * $redis->rPushx('key1', 'C'); // returns 3
+     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function rPushx(string $key, string $value): int + { + + } + + /** + * + *从列表左侧删除一个元素 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->lPop('key1');        // key1 => [ 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @return string + */ + public function lPop(string $key): string + { + + } + + /** + * + *从列表右侧删除一个元素 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->rPop('key1');        // key1 => [ 'A', 'B' ]
+     * 
+ * @param string $key 键名 + * @return string + */ + public function rPop(string $key): string + { + + } + + /** + * + *是一个阻塞lPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表头部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,blPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。 + * @example + *
+     * // Non blocking feature
+     * $redis->lPush('key1', 'A');
+     * $redis->delete('key2');
+     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * // Blocking feature
+     * // process 1
+     * $redis->delete('key1');
+     * $redis->blPop('key1', 10);
+     * // blocking for 10 seconds
+     * // process 2
+     * $redis->lPush('key1', 'A');
+     * // process 1
+     * // array('key1', 'A') is returned
+     * 
+ * @param string|...|array $key 键名 + * @param int $timeout 超时时间 + * @return array + */ + public function blPop(string $key, int $timeout): array + { + + } + + /** + * + *是一个阻塞rPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表尾部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,brPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。 + * @example + *
+     * // Non blocking feature
+     * $redis->lPush('key1', 'A');
+     * $redis->delete('key2');
+     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * // Blocking feature
+     * // process 1
+     * $redis->delete('key1');
+     * $redis->blPop('key1', 10);
+     * // blocking for 10 seconds
+     * // process 2
+     * $redis->lPush('key1', 'A');
+     * // process 1
+     * // array('key1', 'A') is returned
+     * 
+ * @param string|...|array $key 键名 + * @param int $timeout 超时时间 + * @return array + */ + public function brPop(string $key, int $timeout): array + { + + } + + /** + * + *返回列表的长度 + * @example + * @param string|...|array $key 键名 + * @return long | bool + */ + public function lSize(string $key): ?long + { + + } + + /** + * + *从列表中删除指定值的元素。 如果count为零,则删除所有匹配的元素。 如果计数是负数,则元素从尾部移到头部。 + * @example + * @param string $key 键名 + * @param string $value 元素值 + * @param int $count 删除的个数 + * @return long | bool + */ + public function lRemove(string $key, string $value, int $count): ?long + { + + } + + /** + * + *删除指定范围外的其他元素 + * @example + * @param string $key 键名 + * @param int $start 开始索引 + * @param int $end 结束索引 + * @return array | boolean + */ + public function listTrim(string $key, int $start, int $end): ?array + { + + } + + /** + * + *获取列表中指定索引的值 + * @example + * @param string $key 键名 + * @param int $index 索引值 + * @return string | boolean + */ + public function lGet(string $key, int $index): ?string + { + + } + + /** + * + *获取列表指定范围的值 + * @example + * @param string $key 键名 + * @param int $start 索引开始值 + * @param int $end 索引结束值 + * @return array + */ + public function lGetRange(string $key, int $start, int $end): array + { + + } + + /** + * + *给列表指定位置设置新值 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->lGet('key1', 0);     // 'A'
+     * $redis->lSet('key1', 0, 'X');
+     * $redis->lGet('key1', 0);     // 'X'
+     * 
+ * @param string $key 键名 + * @param int $index 索引值 + * @param string $value 新值 + * @return boolean + */ + public function lSet(string $key, int $index, string $value): boolean + { + + } + + /** + * + *在列表中,在某个元素的前面或后面插入一个新值 + * @example + *
+     * $redis->delete('key1');
+     * $redis->lInsert('key1', Redis::AFTER, 'A', 'X');     // 0
+     * $redis->lPush('key1', 'A');
+     * $redis->lPush('key1', 'B');
+     * $redis->lPush('key1', 'C');
+     * $redis->lInsert('key1', Redis::BEFORE, 'C', 'X');    // 4
+     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C')
+     * $redis->lInsert('key1', Redis::AFTER, 'C', 'Y');     // 5
+     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C', 'Y')
+     * $redis->lInsert('key1', Redis::AFTER, 'W', 'value'); // -1
+     * 
+ * @param string $key 键名 + * @param string $position 位置(前面或后面,使用Redis::BEFORE | Redis::AFTER) + * @param string $element 元素 + * @param string $value 新值 + * @return int + */ + public function lInsert(string $key, string $position, string $element, string $value): int + { + + } + + /** + * + *给集合添加元素 + * @example + *
+     * $redis->sAdd('k', 'v1');                // int(1)
+     * $redis->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function sAdd(string $key, string $value): int + { + + } + + /** + * + *给集合批量添加元素 + * @example + * @param string $key 键名 + * @param array $value 元素值 + * @return + */ + public function sAddArray(string $key, Array $value) + { + + } + + /** + * + *返回集合的元素个数 + * @example + * @param string $key 键名 + * @return long + */ + public function sSize(string $key): long + { + + } + + /** + * + *删除集合元素 + * @example + * @param string $key 键名 + * @param string|... $member 成员 + * @return long + */ + public function sRemove(string $key, string $member): long + { + + } + + /** + * + *将某个集合中的元素移动到另外一个集合中 + * @example + *
+     * $redis->sAdd('key1' , 'set11');
+     * $redis->sAdd('key1' , 'set12');
+     * $redis->sAdd('key1' , 'set13');          // 'key1' => {'set11', 'set12', 'set13'}
+     * $redis->sAdd('key2' , 'set21');
+     * $redis->sAdd('key2' , 'set22');          // 'key2' => {'set21', 'set22'}
+     * $redis->sMove('key1', 'key2', 'set13');  // 'key1' =>  {'set11', 'set12'}
+     * // 'key2' =>  {'set21', 'set22', 'set13'}
+     * 
+ * @param string $srcKey 原集合键名 + * @param string $dstKey 目标集合键名 + * @param string $member 成员 + * @return bool + */ + public function sMove(string $srcKey, string $dstKey, string $member): bool + { + + } + + /** + * + *随机删除元素的某个或某些成员,并返回这个删除的成员. + * @example + *
+     * $redis->sAdd('key1' , 'set1');
+     * $redis->sAdd('key1' , 'set2');
+     * $redis->sAdd('key1' , 'set3');   // 'key1' => {'set3', 'set1', 'set2'}
+     * $redis->sPop('key1');            // 'set1', 'key1' => {'set3', 'set2'}
+     * $redis->sPop('key1');            // 'set3', 'key1' => {'set2'}
+     * 
+ * @param string $key 键名 + * @param int $count 删除个数 + * @return string | bool + */ + public function sPop(string $key, int $count): ?string + { + + } + + /** + * + *随机返回一个集合的元素(不会删除它) + * @example + *
+     * $redis->sAdd('key1' , 'one');
+     * $redis->sAdd('key1' , 'two');
+     * $redis->sAdd('key1' , 'three');              // 'key1' => {'one', 'two', 'three'}
+     * var_dump( $redis->sRandMember('key1') );     // 'key1' => {'one', 'two', 'three'}
+     * // string(5) "three"
+     * var_dump( $redis->sRandMember('key1', 2) );  // 'key1' => {'one', 'two', 'three'}
+     * // array(2) {
+     * //   [0]=> string(2) "one"
+     * //   [1]=> string(2) "three"
+     * // }
+     * 
+ * @param string $key 键名 + * @return string | bool + */ + public function sRandMember(string $key): ?string + { + + } + + /** + * + *是否包含某个成员 + * @example + * @param string $key 键名 + * @param string $member 成员值 + * @return boolean + */ + public function sContains(string $key, string $member): boolean + { + + } + + /** + * + *返回集合的所有成员 + * @example + *
+     * $redis->delete('s');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'b');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'c');
+     * var_dump($redis->sMembers('s'));
+     * //array(3) {
+     * //  [0]=>
+     * //  string(1) "c"
+     * //  [1]=>
+     * //  string(1) "a"
+     * //  [2]=>
+     * //  string(1) "b"
+     * //}
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function sMembers(string $key): array + { + + } + + /** + * + *获取两个集合的交集 + * @example + *
+     * $redis->sAdd('key1', 'val1');
+     * $redis->sAdd('key1', 'val2');
+     * $redis->sAdd('key1', 'val3');
+     * $redis->sAdd('key1', 'val4');
+     * $redis->sAdd('key2', 'val3');
+     * $redis->sAdd('key2', 'val4');
+     * $redis->sAdd('key3', 'val3');
+     * $redis->sAdd('key3', 'val4');
+     * var_dump($redis->sInter('key1', 'key2', 'key3'));
+     * //array(2) {
+     * //  [0]=>
+     * //  string(4) "val4"
+     * //  [1]=>
+     * //  string(4) "val3"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string $key2 键名2 + * @return array | boolean + */ + public function sInter(string $key1, string $key2): ?array + { + + } + + /** + * + *获取多个集合的交集,并将结果存入到另外一个集合中 + * @example + *
+     * $redis->sAdd('key1', 'val1');
+     * $redis->sAdd('key1', 'val2');
+     * $redis->sAdd('key1', 'val3');
+     * $redis->sAdd('key1', 'val4');
+     * $redis->sAdd('key2', 'val3');
+     * $redis->sAdd('key2', 'val4');
+     * $redis->sAdd('key3', 'val3');
+     * $redis->sAdd('key3', 'val4');
+     * var_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));
+     * var_dump($redis->sMembers('output'));
+     * //int(2)
+     * //
+     * //array(2) {
+     * //  [0]=>
+     * //  string(4) "val4"
+     * //  [1]=>
+     * //  string(4) "val3"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sInterStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *获取集合的并集 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s1', '3');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * $redis->sAdd('s2', '4');
+     * var_dump($redis->sUnion('s0', 's1', 's2'));
+     * array(4) {
+     * //  [0]=>
+     * //  string(1) "3"
+     * //  [1]=>
+     * //  string(1) "4"
+     * //  [2]=>
+     * //  string(1) "1"
+     * //  [3]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string|... $key2 键名2 + * @return array + */ + public function sUnion(string $key1, string $key2): array + { + + } + + /** + * + *获取多个集合的并集,并将结果存入到另外一个集合中 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s1', '3');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * $redis->sAdd('s2', '4');
+     * var_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));
+     * var_dump($redis->sMembers('dst'));
+     * //int(4)
+     * //array(4) {
+     * //  [0]=>
+     * //  string(1) "3"
+     * //  [1]=>
+     * //  string(1) "4"
+     * //  [2]=>
+     * //  string(1) "1"
+     * //  [3]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sUnionStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *获取多个集合的差集 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s0', '3');
+     * $redis->sAdd('s0', '4');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * var_dump($redis->sDiff('s0', 's1', 's2'));
+     * //array(2) {
+     * //  [0]=>
+     * //  string(1) "4"
+     * //  [1]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string|... $key2 键名2 + * @return array + */ + public function sDiff(string $key1, string $key2): array + { + + } + + /** + * + *获取多个集合的差集,并将结果存入到一个新的集合中 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s0', '3');
+     * $redis->sAdd('s0', '4');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * var_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));
+     * var_dump($redis->sMembers('dst'));
+     * //int(2)
+     * //array(2) {
+     * //  [0]=>
+     * //  string(1) "4"
+     * //  [1]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sDiffStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *设置键的有效期 + * @example + * @param string $key 键名 + * @param int $ttl 有效期(秒数) + * @return boolean + */ + public function setTimeout(string $key, int $ttl): boolean + { + + } + + /** + * + *将数据同步到硬盘上 + * @example $redis->save(); + * @return boolean + */ + public function save(): boolean + { + + } + + /** + * + *将数据存入到硬盘上(异步操作) + * @example + * @return + */ + public function bgSave() + { + + } + + /** + * + *获取上次数据同步到硬盘的时间 + * @example $redis->lastSave(); + * @return int + */ + public function lastSave(): int + { + + } + + /** + * + *删除当前数据库的所有键 + * @example $redis->flushDB(); + * @return bool + */ + public function flushDB(): bool + { + + } + + /** + * + *删除当前实例的所有键 + * @example $redis->flushAll(); + * @return bool + */ + public function flushAll(): bool + { + + } + + /** + * + *获取当前数据库的键的个数 + * @example + *
+     * $count = $redis->dbSize();
+     * echo "Redis has $count keys\n";
+     * 
+ * @return int + */ + public function dbSize(): int + { + + } + + /** + * + *设置连接的认证密码 + * @example $redis->auth('foobared'); + * @param string $password 认证密码 + * @return bool: + */ + public function auth(string $password): bool: + { + + } + + /** + * + *返回指定键的有效时间(秒) + * @example $redis->ttl('key'); + * @param string $key 键名 + * @return long + */ + public function ttl(string $key): long + { + + } + + /** + * + *返回指定键的有效时间(毫秒) + * @example $redis->pttl('key'); + * @param string $key 键名 + * @return long + */ + public function pttl(string $key): long + { + + } + + /** + * + *移除指定键的有效期,让它永久有效 + * @example $redis->persist('key'); + * @param string $key 键名 + * @return bool: + */ + public function persist(string $key): bool: + { + + } + + /** + * + *获取Redis服务器的信息和统计数据 + * @example + *
+     * $redis->info();
+     * or
+     * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
+     * $redis->info("CPU"); // just CPU information from Redis INFO
+     * 
+ * @return array + */ + public function info(): array + { + + } + + /** + * + *切换数据库 + * @example + *
+     * $redis->select(0);       // switch to DB 0
+     * $redis->set('x', '42');  // write 42 to x
+     * $redis->move('x', 1);    // move to DB 1
+     * $redis->select(1);       // switch to DB 1
+     * $redis->get('x');        // will return 42
+     * 
+ * @param int $dbIndex 数据库编号 + * @return bool + */ + public function select(int $dbIndex): bool + { + + } + + /** + * + *将某个键移动到其他数据库中 + * @example + *
+     * $redis->select(0);       // switch to DB 0
+     * $redis->set('x', '42');  // write 42 to x
+     * $redis->move('x', 1);    // move to DB 1
+     * $redis->select(1);       // switch to DB 1
+     * $redis->get('x');        // will return 42
+     * 
+ * @param string $key 键名 + * @param int $dbIndex 数据库编号 + * @return bool + */ + public function move(string $key, int $dbIndex): bool + { + + } + + /** + * + *开启后台写AOF日志操作 + * @example $redis->bgrewriteaof(); + * @return bool + */ + public function bgrewriteaof(): bool + { + + } + + /** + * + *修改从服务状态(参数为空时,表示停止当前从属关系) + * @example + *
+     * $redis->slaveof('10.0.1.7', 6379);
+     * // ...
+     * $redis->slaveof();
+     * 
+ * @param string $host 服务器 + * @param int $port 端口号 + * @return bool: + */ + public function slaveof(string $host, int $port): bool: + { + + } + + /** + * + *获取某个键的对象信息 + * @example + *
+     * $redis->object("encoding", "l"); // → ziplist
+     * $redis->object("refcount", "l"); // → 1
+     * $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
+     * 
+ * @param string $info 获取的信息指标名称(有 encoding、refcount 、idletime 3种可选择) + * @param string $key 键名 + * @return string + */ + public function object(string $info, string $key): string + { + + } + + /** + * + *多个键的位操作,并将结果存入到指定的键中 + * @example + * @param string $operation 操作(有 AND, OR, NOT, XOR 4种可选择) + * @param string $dstKey 目标键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名N + * @return long + */ + public function bitop(string $operation, string $dstKey, string $key1, string $key2, string $keyN): long + { + + } + + /** + * + *统计字符串的位数 + * @example + * @param string $key 键名 + * @return long + */ + public function bitcount(string $key): long + { + + } + + /** + * + *获取指定位置的位值 + * @example + *
+     * $redis->set('key', '\xff\xff');
+     * $redis->bitpos('key', 1); // int(0)
+     * $redis->bitpos('key', 1, 1); // int(8)
+     * $redis->bitpos('key', 1, 3); // int(-1)
+     * $redis->bitpos('key', 0); // int(16)
+     * $redis->bitpos('key', 0, 1); // int(16)
+     * $redis->bitpos('key', 0, 1, 5); // int(-1)
+     * 
+ * @param string $key 键名 + * @param int $bit 位值 + * @param int $start 开始位置 + * @param int $end 结束位置 + * @return function + */ + public function bitpos(string $key, int $bit, int $start, int $end): function + { + + } + + /** + * + *批量设置值 + * @example + *
+     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
+     * var_dump($redis->get('key0'));
+     * var_dump($redis->get('key1'));
+     * // Output:
+     * // string(6) "value0"
+     * // string(6) "value1"
+     * 
+ * @param array $values 要设置的键值对 + * @return bool + */ + public function mset(Array $values): bool + { + + } + + /** + * + *批量设置值(当不存在时设置) + * @example + *
+     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
+     * var_dump($redis->get('key0'));
+     * var_dump($redis->get('key1'));
+     * // Output:
+     * // string(6) "value0"
+     * // string(6) "value1"
+     * 
+ * @param array $values 要设置的键值对 + * @return bool + */ + public function msetnx(Array $values): bool + { + + } + + /** + * + *从一个队列的队尾删除一个元素,并将该元素插入到另一个队列的头部 + * @example + *
+     * $redis->delete('x', 'y');
+     * $redis->lPush('x', 'abc');
+     * $redis->lPush('x', 'def');
+     * $redis->lPush('y', '123');
+     * $redis->lPush('y', '456');
+     * // move the last of x to the front of y.
+     * var_dump($redis->rpoplpush('x', 'y'));
+     * var_dump($redis->lRange('x', 0, -1));
+     * var_dump($redis->lRange('y', 0, -1));
+     * //Output:
+     * //
+     * //string(3) "abc"
+     * //array(1) {
+     * //  [0]=>
+     * //  string(3) "def"
+     * //}
+     * //array(3) {
+     * //  [0]=>
+     * //  string(3) "abc"
+     * //  [1]=>
+     * //  string(3) "456"
+     * //  [2]=>
+     * //  string(3) "123"
+     * //}
+     * 
+ * @param string $srcKey 要删除元素的队列键名 + * @param string $dstKey 要插入元素的队列的键名 + * @return string + */ + public function rpoplpush(string $srcKey, string $dstKey): string + { + + } + + /** + * + *阻塞执行rpoplpush + * @example + * @param string $srcKey 要删除元素的队列键名 + * @param string $dstKey 要插入元素的队列的键名 + * @return string + */ + public function brpoplpush(string $srcKey, string $dstKey): string + { + + } + + /** + * + *向有序集合插入元素 + * @example + *
+     * 
+     * $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
+     * $redis->zRem('z', 'v2', 'v3');                           // int(2)
+     * var_dump( $redis->zRange('z', 0, -1) );
+     * //// Output:
+     * // array(2) {
+     * //   [0]=> string(2) "v1"
+     * //   [1]=> string(2) "v4"
+     * // }
+     * 
+ *
+ * @param string $key 集合键名 + * @param double $score 排序值 + * @param string $value 元素值 + * @return int + */ + public function zAdd(string $key, double $score, string $value): int + { + + } + + /** + * + *删除有序集合中的某个成员 + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zDelete(string $key, string $member): int + { + + } + + /** + * + *获取有序集合中指定范围的成员 + * @example + *
+     * $redis->zAdd('key1', 0, 'val0');
+     * $redis->zAdd('key1', 2, 'val2');
+     * $redis->zAdd('key1', 10, 'val10');
+     * $redis->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
+     * // with scores
+     * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param boolean $withScores 是否返回成员的排序值 + * @return array + */ + public function zRange(string $key, long $start, long $end, boolean $withScores): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(倒序排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
+     * // with scores
+     * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param boolean $withScores 是否返回成员的排序值 + * @return array + */ + public function zRevRange(string $key, long $start, long $end, boolean $withScores): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(按排序值排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param array $options 附加选项(可以是:withscores => TRUE, and limit => array($offset, $count)) + * @return array + */ + public function zRangeByScore(string $key, long $start, long $end, Array $options): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(按排序值倒序排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param array $options 附加选项(可以是:withscores => TRUE, and limit => array($offset, $count)) + * @return array + */ + public function zRevRangeByScore(string $key, long $start, long $end, Array $options): array + { + + } + + /** + * + *按字母字典的顺序返回成员 + * @example + *
+     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
+     * $redis->zAdd('key', $char);
+     * }
+     * $redis->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
+     * $redis->zRangeByLex('key', '-', '(c'); // array('a', 'b')
+     * $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
+     * 
+ * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @param long $offset 索引开始值 + * @param long $limit 成员数 + * @return array + */ + public function zRangeByLex(string $key, long $min, long $max, long $offset, long $limit): array + { + + } + + /** + * + *按字母字典的顺序返回成员(倒序排序) + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @param long $offset 索引开始值 + * @param long $limit 成员数 + * @return + */ + public function zRevRangeByLex(string $key, long $min, long $max, long $offset, long $limit) + { + + } + + /** + * + *获取指定字母范围的成员数 + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @return int + */ + public function zLexCount(string $key, long $min, long $max): int + { + + } + + /** + * + *删除指定字母范围的成员 + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @return long + */ + public function zRemRangeByLex(string $key, long $min, long $max): long + { + + } + + /** + * + *获取指定排序范围的成员数. + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
+     * 
+ * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return int + */ + public function zCount(string $key, double $start, double $end): int + { + + } + + /** + * + *根据排序值范围来删除成员 + * @example + * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return long + */ + public function zDeleteRangeByScore(string $key, double $start, double $end): long + { + + } + + /** + * + *根据排序范围删除成员 + * @example + *
+     * $redis->zAdd('key', 1, 'one');
+     * $redis->zAdd('key', 2, 'two');
+     * $redis->zAdd('key', 3, 'three');
+     * $redis->zRemRangeByRank('key', 0, 1); // 2
+     * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
+     * 
+ * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return int + */ + public function zDeleteRangeByRank(string $key, double $start, double $end): int + { + + } + + /** + * + *获取有序集合的成员数 + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zCard('key');            // 3
+     * 
+ * @param string $key 集合键名 + * @return int + */ + public function zCard(string $key): int + { + + } + + /** + * + *获取指定成员的排序值(分数) + * @example + *
+     * $redis->zAdd('key', 2.5, 'val2');
+     * $redis->zScore('key', 'val2'); // 2.5
+     * 
+ * @param string $key 集合键名 + * @param string $member 成员值 + * @return double + */ + public function zScore(string $key, string $member): double + { + + } + + /** + * + *获取成员的排序值 + * @example + *
+     * $redis->delete('z');
+     * $redis->zAdd('key', 1, 'one');
+     * $redis->zAdd('key', 2, 'two');
+     * $redis->zRank('key', 'one');     // 0
+     * $redis->zRank('key', 'two');     // 1
+     * $redis->zRevRank('key', 'one');  // 1
+     * $redis->zRevRank('key', 'two');  // 0
+     * 
+ * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRank(string $key, string $member): int + { + + } + + /** + * + *获取成员的排位值(倒数) + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRevRank(string $key, string $member): int + { + + } + + /** + * + *将两个有序集合的交集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->delete('ko4');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k1', 3, 'val3');
+     * $redis->zAdd('k2', 2, 'val1');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zInter('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
+     * $redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
+     * // Weighted zInter
+     * $redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
+     * $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zInter(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *将两个有序集合的并集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k2', 2, 'val2');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zUnion('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
+     * // Weighted zUnion
+     * $redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
+     * $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zUnion(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *给有序集合成员增加排序值 + * @example + *
+     * $redis->delete('key');
+     * $redis->zIncrBy('key', 2.5, 'member1');  // key or member1 didn't exist, so member1's score is to 0
+     * // before the increment and now has the value 2.5
+     * $redis->zIncrBy('key', 1, 'member1');    // 3.5
+     * 
+ * @param string $key 目标集合键名 + * @param double $step 增加的步长 + * @param string $member 成员 + * @return float + */ + public function zIncrBy(string $key, double $step, string $member): float + { + + } + + /** + * + *为某个键设置有效期为某个时间点 + * @example + *
+     * $redis->set('x', '42');
+     * $now = time(NULL);               // current timestamp
+     * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
+     * sleep(5);                        // wait 5 seconds
+     * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
+     * 
+ * @param string $key 键名 + * @param int $expireTime 到期时间 + * @return bool: + */ + public function expireAt(string $key, int $expireTime): bool: + { + + } + + /** + * + *设置键的有效期(毫秒为单位) + * @example + * @param string $key 键名 + * @param int $ttl 有效期(毫秒数) + * @return boolean + */ + public function pexpire(string $key, int $ttl): boolean + { + + } + + /** + * + *为某个键设置有效期为某个时间点(精确到毫秒) + * @example + *
+     * $redis->set('x', '42');
+     * $now = time(NULL);               // current timestamp
+     * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
+     * sleep(5);                        // wait 5 seconds
+     * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
+     * 
+ * @param string $key 键名 + * @param int $expireTime 到期时间 + * @return bool: + */ + public function pexpireAt(string $key, int $expireTime): bool: + { + + } + + /** + * + *获取字典的某个字段的值 + * @example + * @param string $key 键名 + * @param string $field 字段名 + * @return string + */ + public function hGet(string $key, string $field): string + { + + } + + /** + * + *为字典的字段设置值 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
+     * $redis->hGet('h', 'key1');           // returns "hello"
+     * $redis->hSet('h', 'key1', 'plop');   // 0, value was replaced.
+     * $redis->hGet('h', 'key1');           // returns "plop"
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param string $value 字段值 + * @return long + */ + public function hSet(string $key, string $field, string $value): long + { + + } + + /** + * + *当字典的字段不存在时,为其设置值 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
+     * $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field
+     * wasn't replaced.
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param string $value 字段值 + * @return bool + */ + public function hSetNx(string $key, string $field, string $value): bool + { + + } + + /** + * + *删除字典的某个或某些字段 + * @example + *
+     * $redis->hMSet('h',
+     * array(
+     * 'f1' => 'v1',
+     * 'f2' => 'v2',
+     * 'f3' => 'v3',
+     * 'f4' => 'v4',
+     * ));
+     * var_dump( $redis->hDel('h', 'f1') );        // int(1)
+     * var_dump( $redis->hDel('h', 'f2', 'f3') );  // int(2)
+     * s
+     * var_dump( $redis->hGetAll('h') );
+     * //// Output:
+     * //  array(1) {
+     * //    ["f4"]=> string(2) "v4"
+     * //  }
+     * 
+ * @param string $key 键名 + * @param string|array $fields 字段名 + * @return int + */ + public function hDel(string $key, string $fields): int + { + + } + + /** + * + *获取字典的字段个数 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSet('h', 'key1', 'hello');
+     * $redis->hSet('h', 'key2', 'plop');
+     * $redis->hLen('h'); // returns 2
+     * 
+ * @param string $key 键名 + * @return int + */ + public function hLen(string $key): int + { + + } + + /** + * + *获取字典的字段名称列表. + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hKeys('h'));
+     * // Output:
+     * // array(4) {
+     * // [0]=>
+     * // string(1) "a"
+     * // [1]=>
+     * // string(1) "b"
+     * // [2]=>
+     * // string(1) "c"
+     * // [3]=>
+     * // string(1) "d"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hKeys(string $key): array + { + + } + + /** + * + *获取字典的字段值列表 + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hVals('h'));
+     * // Output
+     * // array(4) {
+     * //   [0]=>
+     * //   string(1) "x"
+     * //   [1]=>
+     * //   string(1) "y"
+     * //   [2]=>
+     * //   string(1) "z"
+     * //   [3]=>
+     * //   string(1) "t"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hVals(string $key): array + { + + } + + /** + * + *获取字典所有字段键值对 + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hGetAll('h'));
+     * // Output:
+     * // array(4) {
+     * //   ["a"]=>
+     * //   string(1) "x"
+     * //   ["b"]=>
+     * //   string(1) "y"
+     * //   ["c"]=>
+     * //   string(1) "z"
+     * //   ["d"]=>
+     * //   string(1) "t"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hGetAll(string $key): array + { + + } + + /** + * + *判断字典的某个字段是否存在. + * @example + *
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hExists('h', 'a');               //  TRUE
+     * $redis->hExists('h', 'NonExistingKey');  // FALSE
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @return bool + */ + public function hExists(string $key, string $field): bool + { + + } + + /** + * + *为指定字段增加指定的值. + * @example + *
+     * $redis->delete('h');
+     * $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
+     * $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param int $step 自增步长 + * @return int + */ + public function hIncrBy(string $key, string $field, int $step): int + { + + } + + /** + * + *为指定字段增加指定的值 + * @example + *
+     * $redis = new Redis();
+     * $redis->connect('127.0.0.1');
+     * $redis->hset('h', 'float', 3);
+     * $redis->hset('h', 'int',   3);
+     * var_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
+     * var_dump( $redis->hGetAll('h') );
+     * // Output
+     * array(2) {
+     * ["float"]=>
+     * string(3) "4.5"
+     * ["int"]=>
+     * string(1) "3"
+     * }
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param double $step 自增步长 + * @return + */ + public function hIncrByFloat(string $key, string $field, double $step) + { + + } + + /** + * + *批量设置字典字段的值 + * @example + *
+     * $redis->delete('user:1');
+     * $redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));
+     * $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
+     * 
+ * @param string $key 键名 + * @param array $fields 字段键值对 + * @return boolean + */ + public function hMset(string $key, Array $fields): boolean + { + + } + + /** + * + *批量获取字典的字段值 + * @example + * @param string $key 键名 + * @param array $fields 字段名列表 + * @return array + */ + public function hMget(string $key, Array $fields): array + { + + } + + /** + * + *开始一个事务. + * @example + *
+     * $ret = $redis->multi()
+     * ->set('key1', 'val1')
+     * ->get('key1')
+     * ->set('key2', 'val2')
+     * ->get('key2')
+     * ->exec();
+     * //$ret == array (
+     * //    0 => TRUE,
+     * //    1 => 'val1',
+     * //    2 => TRUE,
+     * //    3 => 'val2');
+     * 
+ * @return + */ + public function multi() + { + + } + + /** + * + *取消事务 + * @example + * @return + */ + public function discard() + { + + } + + /** + * + *执行事务 + * @example + * @return + */ + public function exec() + { + + } + + /** + * + *开启一个管道 + * @example + * @return + */ + public function pipeline() + { + + } + + /** + * + *观察某个键在其他客户端的变化情况. + * @example + *
+     * $redis->watch('x');
+     * // long code here during the execution of which other clients could well modify `x`
+     * $ret = $redis->multi()
+     * ->incr('x')
+     * ->exec();
+     * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
+     * 
+ * @param string|array $keys 键名 + * @return + */ + public function watch(string $keys) + { + + } + + /** + * + *取消观察某个键在其他客户端的变化情况 + * @example + * @param string|array $keys 键名 + * @return + */ + public function unwatch(string $keys) + { + + } + + /** + * + *将消息发布到消息通道(队列). + * @example $redis->publish('chan-1', 'hello, world!'); // send message. + * @param string $channel 消息频道 + * @param string $message 消息 + * @return int + */ + public function publish(string $channel, string $message): int + { + + } + + /** + * + *订阅消息 + * @example + *
+     * function f($redis, $chan, $msg) {
+     * switch($chan) {
+     * case 'chan-1':
+     * ...
+     * break;
+     * case 'chan-2':
+     * ...
+     * break;
+     * case 'chan-2':
+     * ...
+     * break;
+     * }
+     * }
+     * $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
+     * 
+ * @param array $channels 订阅的消息频道 + * @param string|array $callback 回调函数名称 + * @param mixed $value 返回值 + * @return mixed + */ + public function subscribe(Array $channels, string $callback, $value) + { + + } + + /** + * + *通过匹配模式来订阅这些匹配的消息频道 + * @example + *
+     * function psubscribe($redis, $pattern, $chan, $msg) {
+     * echo "Pattern: $pattern\n";
+     * echo "Channel: $chan\n";
+     * echo "Payload: $msg\n";
+     * }
+     * 
+ * @param array $patterns 匹配模式 + * @param string|array $callback 回调函数名称 + * @param mixed $value 返回值 + * @return + */ + public function psubscribe(Array $patterns, string $callback, $value) + { + + } + + /** + * + *取消订阅 + * @example + * @param array $channels 订阅的消息频道 + * @return + */ + public function unsubscribe(Array $channels) + { + + } + + /** + * + *通过匹配模式来取消订阅这些匹配的消息频道 + * @example + * @param array $patterns 匹配模式 + * @return + */ + public function punsubscribe(Array $patterns) + { + + } + + /** + * + *返回当前redis服务器时间. + * @example + *
+     * var_dump( $redis->time() );
+     * // array(2) {
+     * //   [0] => string(10) "1342364352"
+     * //   [1] => string(6) "253002"
+     * // }
+     * 
+ * @return int + */ + public function time(): int + { + + } + + /** + * + *返回当前连接的服务器的角色,如master、alone、slave、sentinel + * @example + * @return string + */ + public function role(): string + { + + } + + /** + * + *在脚本子系统上执行redis命令 + * @example + *
+     * $redis->script('load', $script);
+     * $redis->script('flush');
+     * $redis->script('kill');
+     * $redis->script('exists', $script1, [$script2, $script3, ...]);
+     * 
+ * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. + * SCRIPT FLUSH should always return TRUE + * SCRIPT KILL will return true if a script was able to be killed and false if not + * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script + * @param string $command redis命令 + * @param string|... $script 脚本 + * @return + */ + public function script(string $command, string $script) + { + + } + + /** + * + *调试命令(不建议使用) + * @example + * @return + */ + public function debug() + { + + } + + /** + * + *将某个键导出为一个二进制数据. + * @example + *
+     * $redis->set('foo', 'bar');
+     * $val = $redis->dump('foo'); // $val will be the Redis encoded key value
+     * 
+ * @param string $key 键名 + * @return string + */ + public function dump(string $key): string + { + + } + + /** + * + *将dump导出的二进制数据恢复到可读的字符串. + * @example + *
+     * $redis->set('foo', 'bar');
+     * $val = $redis->dump('foo');
+     * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
+     * 
+ * @param string $key 键名 + * @param int $ttl 有效期 + * @param string $value dump导出的二进制数据 + * @return + */ + public function restore(string $key, int $ttl, string $value) + { + + } + + /** + * + *将某个键迁移到其他的Redis实例中 + * @example + *
+     * $redis->migrate('backup', 6379, 'foo', 0, 3600);
+     * 
+ * @param string $host 目标主机 + * @param int $port 目标主机端口 + * @param string|array $keys 迁移的键 + * @param int $database 目标数据库 + * @param int $timeout 超时时间 + * @param boolean $copy 是否复制 + * @param boolean $replace 是否替换 + * @return + */ + public function migrate(string $host, int $port, string $keys, int $database, int $timeout, boolean $copy, boolean $replace) + { + + } + + /** + * + *获取上次错误信息 + * @example + *
+     * $redis->eval('this-is-not-lua');
+     * $err = $redis->getLastError();
+     * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
+     * 
+ * @return string + */ + public function getLastError(): string + { + + } + + /** + * + *清除上次错误信息 + * @example + *
+     * $redis->set('x', 'a');
+     * $redis->incr('x');
+     * $err = $redis->getLastError();
+     * // "ERR value is not an integer or out of range"
+     * $redis->clearLastError();
+     * $err = $redis->getLastError();
+     * // NULL
+     * 
+ * @return bool + */ + public function clearLastError(): bool + { + + } + + /** + * + *设置键前缀 + * @example + *
+     * $redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');
+     * $redis->_prefix('my-value'); // Will return 'my-prefix:my-value'
+     * 
+ * @param string $prefix 前缀 + * @return string + */ + public function _prefix(string $prefix): string + { + + } + + /** + * + *用于手动序列化. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
+     * $redis->_serialize("foo"); // returns "foo"
+     * $redis->_serialize(Array()); // Returns "Array"
+     * $redis->_serialize(new stdClass()); // Returns "Object"
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+     * $redis->_serialize("foo"); // Returns 's:3:"foo";'
+     * 
+ * @param string $value 被序列化的值 + * @return + */ + public function _serialize(string $value) + { + + } + + /** + * + *反序列化方法. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+     * $redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
+     * 
+ * @param string $value 被反序列化的值 + * @return + */ + public function _unserialize(string $value) + { + + } + + /** + * + *获取客户端相关参数或进行相关操作 + * @example + * @param string $command 命令(CLIENT LIST +CLIENT GETNAME +CLIENT SETNAME [name] +CLIENT KILL [ip:port] +) + * @param string $args 参数 + * @return + */ + public function client(string $command, string $args) + { + + } + + /** + * + *获取所有命令列表 + * @example + * @return array + */ + public function command(): array + { + + } + + /** + * + *扫描键空间. + * @example + *
+     * $iterator = null;
+     * while($keys = $redis->scan($iterator)) {
+     * foreach($keys as $key) {
+     * echo $key . PHP_EOL;
+     * }
+     * }
+     * 
+ * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return array + */ + public function scan(Long $i_iterator, string $str_pattern, int $i_count): array + { + + } + + /** + * + *扫描hash的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function hscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *扫描有序集合的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function zscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *扫描集合的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function sscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *将所有元素参数添加到 HyperLogLog 数据结构中 + * @example + * @param string $key 键名 + * @param string|array|... $element 元素 + * @return + */ + public function pfadd(string $key, string $element) + { + + } + + /** + * + *返回给定 HyperLogLog 的基数估算值 + * @example + * @param string|array $keys 键名 + * @return + */ + public function pfcount(string $keys) + { + + } + + /** + * + *将多个 HyperLogLog 合并为一个 HyperLogLog ,合并后的 HyperLogLog 的基数估算值是通过对所有 给定 HyperLogLog 进行并集计算得出的 + * @example + * @param string|array $dstKey 目标键名 + * @param string|array $sourceKeys 源键名 + * @return + */ + public function pfmerge(string $dstKey, string $sourceKeys) + { + + } + + /** + * + *获取客户端选项 + * @example + * // return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY. + * $redis->getOption(Redis::OPT_SERIALIZER); + * @param string $optionName 选项名 + * @return int + */ + public function getOption(string $optionName): int + { + + } + + /** + * + *设置客户端选项. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        // don't serialize data
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         // use built-in serialize/unserialize
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
+     * $redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      // use custom prefix on all keys
+     * 
+ * @param string $optionName 选项名 + * @param string $optionValue 选项值 + * @return bool: + */ + public function setOption(string $optionName, string $optionValue): bool: + { + + } + + /** + * + *获取或设置配置项. + * @example + *
+     * $redis->config("GET", "*max-*-entries*");
+     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
+     * 
+ * @param string $operation 操作(SET或GET) + * @param string $key 配置项或配置项匹配模式 + * @param string $value 配置值 + * @return array + */ + public function config(string $operation, string $key, string $value): array + { + + } + + /** + * + *获取慢操作日志 + * @example + * @param string $command 执行的命令 + * @param int $length 获取条目数 + * @return + */ + public function slowlog(string $command, int $length) + { + + } + + /** + * + *在redis服务器上执行命令 + * @example + * @param string $command 执行的命令 + * @param string|array $args 参数 + * @return + */ + public function rawcommand(string $command, string $args) + { + + } + + /** + * + *获取当前连接HOST + * @example + * @return + */ + public function getHost() + { + + } + + /** + * + *获取当前连接的端口 + * @example + * @return + */ + public function getPort() + { + + } + + /** + * + *获取数据库的数量 + * @example + * @return + */ + public function getDBNum() + { + + } + + /** + * + *获取连接超时时间 + * @example + * @return + */ + public function getTimeout() + { + + } + + /** + * + *获取读操作超时暗 + * @example + * @return + */ + public function getReadTimeout() + { + + } + + /** + * + *获取当前正在使用的持久化操作的ID + * @example + * @return + */ + public function getPersistentID() + { + + } + + /** + * + *获取验证的字符串 + * @example + * @return string + */ + public function getAuth(): string + { + + } + + /** + * + *是否连接成功 + * @example + * @return bool + */ + public function isConnected(): bool + { + + } + + /** + * + *获取运行模式,如 ATOMIC/MULTI/PIPELINE + * @example $redis->getMode(); + * @return int + */ + public function getMode(): int + { + + } + + /** + * + *该命令将阻止当前客户端,直到所有先前的写入命令成功传输并至少由指定数量的从节点进行确认 + * @example $redis->wait(2, 1000); + * @param int $count 从节点数量 + * @param int $timeout 超时时间 + * @return context + */ + public function wait(int $count, int $timeout): context + { + + } + + /** + * + *查看订阅与发布系统状态,它由数个不同格式的子命令组成. + * @example + *
+     * $redis->pubsub('channels'); // All channels
+     * $redis->pubsub('channels', '*pattern*'); // Just channels matching your pattern
+     * $redis->pubsub('numsub', array('chan1', 'chan2')); // Get subscriber counts for 'chan1' and 'chan2'
+     * $redis->pubsub('numpat'); // Get the number of pattern subscribers
+     * 
+ * @param string $subcommand 子命令(可以是channels, numsub, numpat) + * @param string|array $args 参数 + * @return array|int + */ + public function pubsub(string $subcommand, string $args): ?array + { + + } + + /** + * + *连接redis服务器或打开一个已经连接的redis服务器 + * @example + * @param string $host 主机IP + * @param int $port 端口 + * @param float $timeout 连接超时时间(以秒为单位) + * @param mixed $reserved 当使用retry_interval时该值为NULL + * @param int $retry_interval 重试间隔 + * @param float $read_timeout 读操作超时时间 + * @return + */ + public function open(string $host, int $port, float $timeout, $reserved, int $retry_interval, float $read_timeout) + { + + } + + /** + * + *连接redis服务器或打开一个已经连接的redis服务器(长连接) + * @example + * @param string $host 主机IP + * @param int $port 端口 + * @param float $timeout 连接超时时间(以秒为单位) + * @param mixed $reserved 当使用retry_interval时该值为NULL + * @param int $retry_interval 重试间隔 + * @param float $read_timeout 读操作超时时间 + * @return + */ + public function popen(string $host, int $port, float $timeout, $reserved, int $retry_interval, float $read_timeout) + { + + } + + /** + * + *返回列表的长度 + * @example + * @param string|...|array $key 键名 + * @return long | bool + */ + public function lLen(string $key): ?long + { + + } + + /** + * + *返回集合的所有成员 + * @example + *
+     * $redis->delete('s');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'b');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'c');
+     * var_dump($redis->sMembers('s'));
+     * //array(3) {
+     * //  [0]=>
+     * //  string(1) "c"
+     * //  [1]=>
+     * //  string(1) "a"
+     * //  [2]=>
+     * //  string(1) "b"
+     * //}
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function sGetMembers(string $key): array + { + + } + + /** + * + *批量获取键名 + * @example + *
+     * $redis->delete('x', 'y', 'z', 'h');	// remove x y z
+     * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
+     * $redis->hset('h', 'field', 'value');
+     * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
+     * // Output:
+     * // array(3) {
+     * // [0]=>
+     * // string(1) "a"
+     * // [1]=>
+     * // string(1) "b"
+     * // [2]=>
+     * // string(1) "c"
+     * // [3]=>
+     * // bool(false)
+     * // }
+     * 
+ * @param array $keys 键名数组 + * @return + */ + public function mget(Array $keys) + { + + } + + /** + * + *设置键的有效期 + * @example + * @param string $key 键名 + * @param int $ttl 有效期(秒数) + * @return boolean + */ + public function expire(string $key, int $ttl): boolean + { + + } + + /** + * + *将两个有序集合的并集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k2', 2, 'val2');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zUnion('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
+     * // Weighted zUnion
+     * $redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
+     * $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zunionstore(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *将两个有序集合的交集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->delete('ko4');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k1', 3, 'val3');
+     * $redis->zAdd('k2', 2, 'val1');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zInter('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
+     * $redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
+     * // Weighted zInter
+     * $redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
+     * $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zinterstore(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *删除有序集合中的某个成员 + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRemove(string $key, string $member): int + { + + } + + /** + * + *删除有序集合中的某个成员 + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRem(string $key, string $member): int + { + + } + + /** + * + *根据排序值范围来删除成员 + * @example + * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return long + */ + public function zRemoveRangeByScore(string $key, double $start, double $end): long + { + + } + + /** + * + *根据排序值范围来删除成员 + * @example + * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return long + */ + public function zRemRangeByScore(string $key, double $start, double $end): long + { + + } + + /** + * + *根据排序范围删除成员 + * @example + *
+     * $redis->zAdd('key', 1, 'one');
+     * $redis->zAdd('key', 2, 'two');
+     * $redis->zAdd('key', 3, 'three');
+     * $redis->zRemRangeByRank('key', 0, 1); // 2
+     * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
+     * 
+ * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return int + */ + public function zRemRangeByRank(string $key, double $start, double $end): int + { + + } + + /** + * + *获取有序集合的成员数 + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zCard('key');            // 3
+     * 
+ * @param string $key 集合键名 + * @return int + */ + public function zSize(string $key): int + { + + } + + /** + * + *获取一个键值的子字符串 + * @example + *
+     * $redis->set('key', 'string value');
+     * $redis->getRange('key', 0, 5);   // 'string'
+     * $redis->getRange('key', -5, -1); // 'value'
+     * 
+ * @param string $key 键名 + * @param int $start 开始位置 + * @param int $end 结束位置 + * @return string: + */ + public function substr(string $key, int $start, int $end): string: + { + + } + + /** + * + *给键重命名 + * @example + * @param string $srcKey 旧键名 + * @param string $dstKey 新键名 + * @return boolean + */ + public function rename(string $srcKey, string $dstKey): boolean + { + + } + + /** + * + *删除一个或多个键 + * @example $redis->delete('key1', 'key2'); + * $redis->delete(array('key3', 'key4')); + * @param array|string $keys 键名 + * @return int + */ + public function del(array $keys): int + { + + } + + /** + * + *根据匹配模式获取键名(如*) + * @example + * $allKeys = $redis->keys('*'); + * $keyWithUserPrefix = $redis->keys('user*'); + * @param string $pattern 匹配模式 + * @return array + */ + public function keys(string $pattern): array + { + + } + + /** + * + *从列表中删除指定值的元素。 如果count为零,则删除所有匹配的元素。 如果计数是负数,则元素从尾部移到头部。 + * @example + * @param string $key 键名 + * @param string $value 元素值 + * @param int $count 删除的个数 + * @return long | bool + */ + public function lrem(string $key, string $value, int $count): ?long + { + + } + + /** + * + *删除指定范围外的其他元素 + * @example + * @param string $key 键名 + * @param int $start 开始索引 + * @param int $end 结束索引 + * @return array | boolean + */ + public function ltrim(string $key, int $start, int $end): ?array + { + + } + + /** + * + *获取列表中指定索引的值 + * @example + * @param string $key 键名 + * @param int $index 索引值 + * @return string | boolean + */ + public function lindex(string $key, int $index): ?string + { + + } + + /** + * + *获取列表指定范围的值 + * @example + * @param string $key 键名 + * @param int $start 索引开始值 + * @param int $end 索引结束值 + * @return array + */ + public function lrange(string $key, int $start, int $end): array + { + + } + + /** + * + *返回集合的元素个数 + * @example + * @param string $key 键名 + * @return long + */ + public function scard(string $key): long + { + + } + + /** + * + *删除集合元素 + * @example + * @param string $key 键名 + * @param string|... $member 成员 + * @return long + */ + public function srem(string $key, string $member): long + { + + } + + /** + * + *是否包含某个成员 + * @example + * @param string $key 键名 + * @param string $member 成员值 + * @return boolean + */ + public function sismember(string $key, string $member): boolean + { + + } + + /** + * + *获取有序集合中指定范围的成员(倒序排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
+     * // with scores
+     * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param boolean $withScores 是否返回成员的排序值 + * @return array + */ + public function zReverseRange(string $key, long $start, long $end, boolean $withScores): array + { + + } + + /** + * + *向redis发送一个字符串,而且redis服务器将返回一个相同的字符串 + * @example + * @param string $str 发送的字符串 + * @return string + */ + public function sendEcho(string $str): string + { + + } + + /** + * + *执行lua脚本 + * @example + * @param string $script 脚本 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return mixed + */ + public function evaluate(string $script, Array $args, int $num_keys) + { + + } + + /** + * + *执行lua脚本 + * @example + * @param string $script 脚本 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return mixed + */ + public function eval(string $script, Array $args, int $num_keys) + { + + } + + /** + * + *从脚本的SHA1散列而不是脚本本身执行LUA脚本 + * @example $script = 'return 1'; + * $sha = $redis->script('load', $script); + * $redis->evalSha($sha); // Returns 1 + * @param string $script_sha 脚本的散列值 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return + */ + public function evaluateSha(string $script_sha, Array $args, int $num_keys) + { + + } + + /** + * + *从脚本的SHA1散列而不是脚本本身执行LUA脚本 + * @example $script = 'return 1'; + * $sha = $redis->script('load', $script); + * $redis->evalSha($sha); // Returns 1 + * @param string $script_sha 脚本的散列值 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return + */ + public function evalSha(string $script_sha, Array $args, int $num_keys) + { + + } + +} + diff --git a/data/output/Redis/RedisArray.php b/data/output/Redis/RedisArray.php new file mode 100644 index 0000000..1cd11e9 --- /dev/null +++ b/data/output/Redis/RedisArray.php @@ -0,0 +1,397 @@ + + * $redis->select(0); // switch to DB 0 + * $redis->set('x', '42'); // write 42 to x + * $redis->move('x', 1); // move to DB 1 + * $redis->select(1); // switch to DB 1 + * $redis->get('x'); // will return 42 + *
+ * @param int $dbIndex 数据库编号 + * @return bool + */ + public function select(int $dbIndex): bool + { + + } + + /** + * + *获取Redis服务器的信息和统计数据 + * @example + *
+     * $redis->info();
+     * or
+     * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
+     * $redis->info("CPU"); // just CPU information from Redis INFO
+     * 
+ * @return array + */ + public function info(): array + { + + } + + /** + * + *检查当前redis连接状态(成功时返回PONG) + * @example + * @return string + */ + public function ping(): string + { + + } + + /** + * + *删除当前数据库的所有键 + * @example $redis->flushDB(); + * @return bool + */ + public function flushDB(): bool + { + + } + + /** + * + *删除当前实例的所有键 + * @example $redis->flushAll(); + * @return bool + */ + public function flushAll(): bool + { + + } + + /** + * + *批量获取键名 + * @example + *
+     * $redis->delete('x', 'y', 'z', 'h');	// remove x y z
+     * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
+     * $redis->hset('h', 'field', 'value');
+     * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
+     * // Output:
+     * // array(3) {
+     * // [0]=>
+     * // string(1) "a"
+     * // [1]=>
+     * // string(1) "b"
+     * // [2]=>
+     * // string(1) "c"
+     * // [3]=>
+     * // bool(false)
+     * // }
+     * 
+ * @param array $keys 键名数组 + * @return + */ + public function mget(Array $keys) + { + + } + + /** + * + *批量设置值 + * @example + *
+     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
+     * var_dump($redis->get('key0'));
+     * var_dump($redis->get('key1'));
+     * // Output:
+     * // string(6) "value0"
+     * // string(6) "value1"
+     * 
+ * @param array $values 要设置的键值对 + * @return bool + */ + public function mset(Array $values): bool + { + + } + + /** + * + *删除一个或多个键 + * @example $redis->delete('key1', 'key2'); + * $redis->delete(array('key3', 'key4')); + * @param array|string $keys 键名 + * @return int + */ + public function del(array $keys): int + { + + } + + /** + * + *获取客户端选项 + * @example + * // return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY. + * $redis->getOption(Redis::OPT_SERIALIZER); + * @param string $optionName 选项名 + * @return int + */ + public function getOption(string $optionName): int + { + + } + + /** + * + *设置客户端选项. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        // don't serialize data
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         // use built-in serialize/unserialize
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
+     * $redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      // use custom prefix on all keys
+     * 
+ * @param string $optionName 选项名 + * @param string $optionValue 选项值 + * @return bool: + */ + public function setOption(string $optionName, string $optionValue): bool: + { + + } + + /** + * + *根据匹配模式获取键名(如*) + * @example + * $allKeys = $redis->keys('*'); + * $keyWithUserPrefix = $redis->keys('user*'); + * @param string $pattern 匹配模式 + * @return array + */ + public function keys(string $pattern): array + { + + } + + /** + * + *将数据同步到硬盘上 + * @example $redis->save(); + * @return boolean + */ + public function save(): boolean + { + + } + + /** + * + *将数据存入到硬盘上(异步操作) + * @example + * @return + */ + public function bgSave() + { + + } + + /** + * + *开始一个事务. + * @example + *
+     * $ret = $redis->multi()
+     * ->set('key1', 'val1')
+     * ->get('key1')
+     * ->set('key2', 'val2')
+     * ->get('key2')
+     * ->exec();
+     * //$ret == array (
+     * //    0 => TRUE,
+     * //    1 => 'val1',
+     * //    2 => TRUE,
+     * //    3 => 'val2');
+     * 
+ * @return + */ + public function multi() + { + + } + + /** + * + *取消事务 + * @example + * @return + */ + public function discard() + { + + } + + /** + * + *执行事务 + * @example + * @return + */ + public function exec() + { + + } + + /** + * + *取消观察某个键在其他客户端的变化情况 + * @example + * @param string|array $keys 键名 + * @return + */ + public function unwatch(string $keys) + { + + } + + /** + * + *删除一个或多个键 + * @example $redis->delete('key1', 'key2'); + * $redis->delete(array('key3', 'key4')); + * @param array|string $keys 键名 + * @return int + */ + public function delete(array $keys): int + { + + } + + /** + * + *批量获取键值 + * @example + *
+     * $redis->set('key1', 'value1');
+     * $redis->set('key2', 'value2');
+     * $redis->set('key3', 'value3');
+     * $redis->getMultiple(array('key1', 'key2', 'key3')); // array('value1', 'value2', 'value3');
+     * $redis->getMultiple(array('key0', 'key1', 'key5')); // array(`FALSE`, 'value2', `FALSE`);
+     * 
+ * @param array $keys 键名数组 + * @return array + */ + public function getMultiple(Array $keys): array + { + + } + +} + diff --git a/data/output/Redis/RedisCluster.php b/data/output/Redis/RedisCluster.php new file mode 100644 index 0000000..0b1d838 --- /dev/null +++ b/data/output/Redis/RedisCluster.php @@ -0,0 +1,3042 @@ +=1)个slave,当master挂掉以后,能选出一个slave晋升成Master继续提供服务。Failover由失败判定和Leader选举两部分组成,Redis Cluster采用去中心化(Gossip)的设计,每个节点通过发送Ping(包括Gossip信息)/Pong心跳的方式来探测对方节点的存活,如果心跳超时则标记对方节点的状态为PFail,这个意思是说该节点认为对方节点可能失败了,有可能是网络闪断或者分区等其他原因导致通讯失败) + */ + const FAILOVER_DISTRIBUTE = 2; + + /** + * + */ + const FAILOVER_DISTRIBUTE_SLAVES = 3; + + /** + *后面位置 + */ + const AFTER = 'after'; + + /** + *前面位置 + */ + const BEFORE = 'before'; + + /** + * + *创建一个集群对象 + * @example $redis = new RedisCluster(null, array('127.0.0.1:6379', '127.0.0.1:6380')); + * @param string $name 集群名称(在php.ini配置文件或redis.ini配置文件中配置,不配置则为NULL) + * @param array $config 连接的集群节点配置项,如array('127.0.0.1:6379', '127.0.0.1:6380') + * @param float $timeout 连接超时时间 + * @param float $read_timeout 读操作超时时间 + * @param boolean $persistent 与每个节点持久化连接 + * @return + */ + public function __construct(string $name, Array $config, float $timeout, float $read_timeout, boolean $persistent) + { + + } + + /** + * + *关闭redis连接(长连接除外) + * @example + * @return + */ + public function close() + { + + } + + /** + * + *获取指定的key的值 + * @example $redis->get('key'); + * @return string|bool + */ + public function get(): ?string + { + + } + + /** + * + *给指定的键设置值 + * @example 直接设置: + * $redis->set('key', 'value'); + * 带有效期的设置: + * $redis->set('key','value', 10); + * 当键不存在时,设置期有效期为10秒: + * $redis->set('key', 'value', Array('nx', 'ex'=>10)); + * 当键存在时,设置期有效期为1000毫秒: + * $redis->set('key', 'value', Array('xx', 'px'=>1000)); + * + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int|array $options 附加项,可以是超时时间或者一个选项数组 + * @return bool + */ + public function set(string $key, string $value, int $options): bool + { + + } + + /** + * + *批量获取键名 + * @example + *
+     * $redis->delete('x', 'y', 'z', 'h');	// remove x y z
+     * $redis->mset(array('x' => 'a', 'y' => 'b', 'z' => 'c'));
+     * $redis->hset('h', 'field', 'value');
+     * var_dump($redis->mget(array('x', 'y', 'z', 'h')));
+     * // Output:
+     * // array(3) {
+     * // [0]=>
+     * // string(1) "a"
+     * // [1]=>
+     * // string(1) "b"
+     * // [2]=>
+     * // string(1) "c"
+     * // [3]=>
+     * // bool(false)
+     * // }
+     * 
+ * @param array $keys 键名数组 + * @return + */ + public function mget(Array $keys) + { + + } + + /** + * + *批量设置值 + * @example + *
+     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
+     * var_dump($redis->get('key0'));
+     * var_dump($redis->get('key1'));
+     * // Output:
+     * // string(6) "value0"
+     * // string(6) "value1"
+     * 
+ * @param array $values 要设置的键值对 + * @return bool + */ + public function mset(Array $values): bool + { + + } + + /** + * + *批量设置值(当不存在时设置) + * @example + *
+     * $redis->mset(array('key0' => 'value0', 'key1' => 'value1'));
+     * var_dump($redis->get('key0'));
+     * var_dump($redis->get('key1'));
+     * // Output:
+     * // string(6) "value0"
+     * // string(6) "value1"
+     * 
+ * @param array $values 要设置的键值对 + * @return bool + */ + public function msetnx(Array $values): bool + { + + } + + /** + * + *删除一个或多个键 + * @example $redis->delete('key1', 'key2'); + * $redis->delete(array('key3', 'key4')); + * @param array|string $keys 键名 + * @return int + */ + public function del(array $keys): int + { + + } + + /** + * + *设置键值并设置有效期 + * @example $redis->setex('key', 3600, 'value'); + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int $ttl 有效期 + * @return bool + */ + public function setex(string $key, string $value, int $ttl): bool + { + + } + + /** + * + *设置键值并设置有效期(毫秒为单位) + * @example + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @param int $ttl 有效期(毫秒为单位) + * @return + */ + public function psetex(string $key, string $value, int $ttl) + { + + } + + /** + * + *当键不存在时设置其值 + * @example + * $redis->setnx('key', 'value'); + * + * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @return bool: + */ + public function setnx(string $key, string $value): bool: + { + + } + + /** + * + *设置键的值,并返回它的旧的缓存值 + * @example + *
+     * $redis->set('x', '42');
+     * $exValue = $redis->getSet('x', 'lol');   // return '42', replaces x by 'lol'
+     * $newValue = $redis->get('x')'            // return 'lol'
+     * 
+ * @param string $key 设置的缓存键 + * @param string $value 设置的缓存值 + * @return string + */ + public function getset(string $key, string $value): string + { + + } + + /** + * + *判断键是否存在 + * @example + *
+     * $redis->set('key', 'value');
+     * $redis->exists('key');               //  TRUE
+     * $redis->exists('NonExistingKey');    // FALSE
+     * 
+ * @param string $key 键名 + * @return bool + */ + public function exists(string $key): bool + { + + } + + /** + * + *根据匹配模式获取键名(如*) + * @example + * $allKeys = $redis->keys('*'); + * $keyWithUserPrefix = $redis->keys('user*'); + * @param string $pattern 匹配模式 + * @return array + */ + public function keys(string $pattern): array + { + + } + + /** + * + *获取指定键的数据类型(需要根据常量匹配) + * @example $redis->type('key'); + * @param string $key 键名 + * @return int + */ + public function type(string $key): int + { + + } + + /** + * + *从列表左侧删除一个元素 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->lPop('key1');        // key1 => [ 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @return string + */ + public function lPop(string $key): string + { + + } + + /** + * + *从列表右侧删除一个元素 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->rPop('key1');        // key1 => [ 'A', 'B' ]
+     * 
+ * @param string $key 键名 + * @return string + */ + public function rPop(string $key): string + { + + } + + /** + * + *给列表指定位置设置新值 + * @example + *
+     * $redis->rPush('key1', 'A');
+     * $redis->rPush('key1', 'B');
+     * $redis->rPush('key1', 'C');  // key1 => [ 'A', 'B', 'C' ]
+     * $redis->lGet('key1', 0);     // 'A'
+     * $redis->lSet('key1', 0, 'X');
+     * $redis->lGet('key1', 0);     // 'X'
+     * 
+ * @param string $key 键名 + * @param int $index 索引值 + * @param string $value 新值 + * @return boolean + */ + public function lset(string $key, int $index, string $value): boolean + { + + } + + /** + * + *随机删除元素的某个或某些成员,并返回这个删除的成员. + * @example + *
+     * $redis->sAdd('key1' , 'set1');
+     * $redis->sAdd('key1' , 'set2');
+     * $redis->sAdd('key1' , 'set3');   // 'key1' => {'set3', 'set1', 'set2'}
+     * $redis->sPop('key1');            // 'set1', 'key1' => {'set3', 'set2'}
+     * $redis->sPop('key1');            // 'set3', 'key1' => {'set2'}
+     * 
+ * @param string $key 键名 + * @param int $count 删除个数 + * @return string | bool + */ + public function spop(string $key, int $count): ?string + { + + } + + /** + * + *从左侧(头部)向列表插入元素 + * @example + *
+     * $redis->lPush('l', 'v1', 'v2', 'v3', 'v4')   // int(4)
+     * var_dump( $redis->lRange('l', 0, -1) );
+     * //// Output:
+     * // array(4) {
+     * //   [0]=> string(2) "v4"
+     * //   [1]=> string(2) "v3"
+     * //   [2]=> string(2) "v2"
+     * //   [3]=> string(2) "v1"
+     * // }
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function lPush(string $key, string $value): int + { + + } + + /** + * + *从右侧(尾部)向列表插入元素 + * @example + *
+     * $redis->rPush('l', 'v1', 'v2', 'v3', 'v4');    // int(4)
+     * var_dump( $redis->lRange('l', 0, -1) );
+     * //// Output:
+     * // array(4) {
+     * //   [0]=> string(2) "v1"
+     * //   [1]=> string(2) "v2"
+     * //   [2]=> string(2) "v3"
+     * //   [3]=> string(2) "v4"
+     * // }
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function rPush(string $key, string $value): int + { + + } + + /** + * + *是一个阻塞lPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表头部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,blPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。 + * @example + *
+     * // Non blocking feature
+     * $redis->lPush('key1', 'A');
+     * $redis->delete('key2');
+     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * // Blocking feature
+     * // process 1
+     * $redis->delete('key1');
+     * $redis->blPop('key1', 10);
+     * // blocking for 10 seconds
+     * // process 2
+     * $redis->lPush('key1', 'A');
+     * // process 1
+     * // array('key1', 'A') is returned
+     * 
+ * @param string|...|array $key 键名 + * @param int $timeout 超时时间 + * @return array + */ + public function blPop(string $key, int $timeout): array + { + + } + + /** + * + *是一个阻塞rPop原语。 如果至少有一个列表包含至少一个元素,则该元素将从列表尾部弹出并返回给调用者。 如果所有通过参数传递的键标识的列表都是空的,brPop将在指定的超时期间阻塞,直到元素被推送到其中一个列表。 这个元素将被弹出。 + * @example + *
+     * // Non blocking feature
+     * $redis->lPush('key1', 'A');
+     * $redis->delete('key2');
+     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
+     * // OR
+     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
+     * // Blocking feature
+     * // process 1
+     * $redis->delete('key1');
+     * $redis->blPop('key1', 10);
+     * // blocking for 10 seconds
+     * // process 2
+     * $redis->lPush('key1', 'A');
+     * // process 1
+     * // array('key1', 'A') is returned
+     * 
+ * @param string|...|array $key 键名 + * @param int $timeout 超时时间 + * @return array + */ + public function brPop(string $key, int $timeout): array + { + + } + + /** + * + *如果列表存在,从左侧(头部)向列表插入元素 + * @example + *
+     * $redis->delete('key1');
+     * $redis->lPushx('key1', 'A');     // returns 0
+     * $redis->lPush('key1', 'A');      // returns 1
+     * $redis->lPushx('key1', 'B');     // returns 2
+     * $redis->lPushx('key1', 'C');     // returns 3
+     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function lPushx(string $key, string $value): int + { + + } + + /** + * + *如果列表存在,从右侧(尾部)向列表插入元素 + * @example + *
+     * $redis->delete('key1');
+     * $redis->rPushx('key1', 'A'); // returns 0
+     * $redis->rPush('key1', 'A'); // returns 1
+     * $redis->rPushx('key1', 'B'); // returns 2
+     * $redis->rPushx('key1', 'C'); // returns 3
+     * // key1 now points to the following list: [ 'A', 'B', 'C' ]
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function rPushx(string $key, string $value): int + { + + } + + /** + * + *在列表中,在某个元素的前面或后面插入一个新值 + * @example + *
+     * $redis->delete('key1');
+     * $redis->lInsert('key1', Redis::AFTER, 'A', 'X');     // 0
+     * $redis->lPush('key1', 'A');
+     * $redis->lPush('key1', 'B');
+     * $redis->lPush('key1', 'C');
+     * $redis->lInsert('key1', Redis::BEFORE, 'C', 'X');    // 4
+     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C')
+     * $redis->lInsert('key1', Redis::AFTER, 'C', 'Y');     // 5
+     * $redis->lRange('key1', 0, -1);                       // array('A', 'B', 'X', 'C', 'Y')
+     * $redis->lInsert('key1', Redis::AFTER, 'W', 'value'); // -1
+     * 
+ * @param string $key 键名 + * @param string $position 位置(前面或后面,使用Redis::BEFORE | Redis::AFTER) + * @param string $element 元素 + * @param string $value 新值 + * @return int + */ + public function linsert(string $key, string $position, string $element, string $value): int + { + + } + + /** + * + *获取列表中指定索引的值 + * @example + * @param string $key 键名 + * @param int $index 索引值 + * @return string | boolean + */ + public function lindex(string $key, int $index): ?string + { + + } + + /** + * + *从列表中删除指定值的元素。 如果count为零,则删除所有匹配的元素。 如果计数是负数,则元素从尾部移到头部。 + * @example + * @param string $key 键名 + * @param string $value 元素值 + * @param int $count 删除的个数 + * @return long | bool + */ + public function lrem(string $key, string $value, int $count): ?long + { + + } + + /** + * + *从一个队列的队尾删除一个元素,并将该元素插入到另一个队列的头部 + * @example + *
+     * $redis->delete('x', 'y');
+     * $redis->lPush('x', 'abc');
+     * $redis->lPush('x', 'def');
+     * $redis->lPush('y', '123');
+     * $redis->lPush('y', '456');
+     * // move the last of x to the front of y.
+     * var_dump($redis->rpoplpush('x', 'y'));
+     * var_dump($redis->lRange('x', 0, -1));
+     * var_dump($redis->lRange('y', 0, -1));
+     * //Output:
+     * //
+     * //string(3) "abc"
+     * //array(1) {
+     * //  [0]=>
+     * //  string(3) "def"
+     * //}
+     * //array(3) {
+     * //  [0]=>
+     * //  string(3) "abc"
+     * //  [1]=>
+     * //  string(3) "456"
+     * //  [2]=>
+     * //  string(3) "123"
+     * //}
+     * 
+ * @param string $srcKey 要删除元素的队列键名 + * @param string $dstKey 要插入元素的队列的键名 + * @return string + */ + public function rpoplpush(string $srcKey, string $dstKey): string + { + + } + + /** + * + *阻塞执行rpoplpush + * @example + * @param string $srcKey 要删除元素的队列键名 + * @param string $dstKey 要插入元素的队列的键名 + * @return string + */ + public function brpoplpush(string $srcKey, string $dstKey): string + { + + } + + /** + * + *返回列表的长度 + * @example + * @param string|...|array $key 键名 + * @return long | bool + */ + public function llen(string $key): ?long + { + + } + + /** + * + *返回集合的元素个数 + * @example + * @param string $key 键名 + * @return long + */ + public function scard(string $key): long + { + + } + + /** + * + *返回集合的所有成员 + * @example + *
+     * $redis->delete('s');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'b');
+     * $redis->sAdd('s', 'a');
+     * $redis->sAdd('s', 'c');
+     * var_dump($redis->sMembers('s'));
+     * //array(3) {
+     * //  [0]=>
+     * //  string(1) "c"
+     * //  [1]=>
+     * //  string(1) "a"
+     * //  [2]=>
+     * //  string(1) "b"
+     * //}
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function smembers(string $key): array + { + + } + + /** + * + *是否包含某个成员 + * @example + * @param string $key 键名 + * @param string $member 成员值 + * @return boolean + */ + public function sismember(string $key, string $member): boolean + { + + } + + /** + * + *给集合添加元素 + * @example + *
+     * $redis->sAdd('k', 'v1');                // int(1)
+     * $redis->sAdd('k', 'v1', 'v2', 'v3');    // int(2)
+     * 
+ * @param string $key 键名 + * @param string $value 元素值 + * @return int + */ + public function sAdd(string $key, string $value): int + { + + } + + /** + * + *给集合批量添加元素 + * @example + * @param string $key 键名 + * @param array $value 元素值 + * @return + */ + public function sAddArray(string $key, Array $value) + { + + } + + /** + * + *删除集合元素 + * @example + * @param string $key 键名 + * @param string|... $member 成员 + * @return long + */ + public function srem(string $key, string $member): long + { + + } + + /** + * + *获取集合的并集 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s1', '3');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * $redis->sAdd('s2', '4');
+     * var_dump($redis->sUnion('s0', 's1', 's2'));
+     * array(4) {
+     * //  [0]=>
+     * //  string(1) "3"
+     * //  [1]=>
+     * //  string(1) "4"
+     * //  [2]=>
+     * //  string(1) "1"
+     * //  [3]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string|... $key2 键名2 + * @return array + */ + public function sUnion(string $key1, string $key2): array + { + + } + + /** + * + *获取多个集合的并集,并将结果存入到另外一个集合中 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s1', '3');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * $redis->sAdd('s2', '4');
+     * var_dump($redis->sUnionStore('dst', 's0', 's1', 's2'));
+     * var_dump($redis->sMembers('dst'));
+     * //int(4)
+     * //array(4) {
+     * //  [0]=>
+     * //  string(1) "3"
+     * //  [1]=>
+     * //  string(1) "4"
+     * //  [2]=>
+     * //  string(1) "1"
+     * //  [3]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sUnionStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *获取两个集合的交集 + * @example + *
+     * $redis->sAdd('key1', 'val1');
+     * $redis->sAdd('key1', 'val2');
+     * $redis->sAdd('key1', 'val3');
+     * $redis->sAdd('key1', 'val4');
+     * $redis->sAdd('key2', 'val3');
+     * $redis->sAdd('key2', 'val4');
+     * $redis->sAdd('key3', 'val3');
+     * $redis->sAdd('key3', 'val4');
+     * var_dump($redis->sInter('key1', 'key2', 'key3'));
+     * //array(2) {
+     * //  [0]=>
+     * //  string(4) "val4"
+     * //  [1]=>
+     * //  string(4) "val3"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string $key2 键名2 + * @return array | boolean + */ + public function sInter(string $key1, string $key2): ?array + { + + } + + /** + * + *获取多个集合的交集,并将结果存入到另外一个集合中 + * @example + *
+     * $redis->sAdd('key1', 'val1');
+     * $redis->sAdd('key1', 'val2');
+     * $redis->sAdd('key1', 'val3');
+     * $redis->sAdd('key1', 'val4');
+     * $redis->sAdd('key2', 'val3');
+     * $redis->sAdd('key2', 'val4');
+     * $redis->sAdd('key3', 'val3');
+     * $redis->sAdd('key3', 'val4');
+     * var_dump($redis->sInterStore('output', 'key1', 'key2', 'key3'));
+     * var_dump($redis->sMembers('output'));
+     * //int(2)
+     * //
+     * //array(2) {
+     * //  [0]=>
+     * //  string(4) "val4"
+     * //  [1]=>
+     * //  string(4) "val3"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sInterStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *获取多个集合的差集 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s0', '3');
+     * $redis->sAdd('s0', '4');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * var_dump($redis->sDiff('s0', 's1', 's2'));
+     * //array(2) {
+     * //  [0]=>
+     * //  string(1) "4"
+     * //  [1]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $key1 键名1 + * @param string|... $key2 键名2 + * @return array + */ + public function sDiff(string $key1, string $key2): array + { + + } + + /** + * + *获取多个集合的差集,并将结果存入到一个新的集合中 + * @example + *
+     * $redis->delete('s0', 's1', 's2');
+     * $redis->sAdd('s0', '1');
+     * $redis->sAdd('s0', '2');
+     * $redis->sAdd('s0', '3');
+     * $redis->sAdd('s0', '4');
+     * $redis->sAdd('s1', '1');
+     * $redis->sAdd('s2', '3');
+     * var_dump($redis->sDiffStore('dst', 's0', 's1', 's2'));
+     * var_dump($redis->sMembers('dst'));
+     * //int(2)
+     * //array(2) {
+     * //  [0]=>
+     * //  string(1) "4"
+     * //  [1]=>
+     * //  string(1) "2"
+     * //}
+     * 
+ * @param string $dstKey 目标键,存放结果的键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名n + * @return int + */ + public function sDiffStore(string $dstKey, string $key1, string $key2, string $keyN): int + { + + } + + /** + * + *随机返回一个集合的元素(不会删除它) + * @example + *
+     * $redis->sAdd('key1' , 'one');
+     * $redis->sAdd('key1' , 'two');
+     * $redis->sAdd('key1' , 'three');              // 'key1' => {'one', 'two', 'three'}
+     * var_dump( $redis->sRandMember('key1') );     // 'key1' => {'one', 'two', 'three'}
+     * // string(5) "three"
+     * var_dump( $redis->sRandMember('key1', 2) );  // 'key1' => {'one', 'two', 'three'}
+     * // array(2) {
+     * //   [0]=> string(2) "one"
+     * //   [1]=> string(2) "three"
+     * // }
+     * 
+ * @param string $key 键名 + * @return string | bool + */ + public function srandmember(string $key): ?string + { + + } + + /** + * + *获取键值的长度 + * @example + *
+     * $redis->set('key', 'value');
+     * $redis->strlen('key'); // 5
+     * 
+ * @param string $key 键名 + * @return int + */ + public function strlen(string $key): int + { + + } + + /** + * + *移除指定键的有效期,让它永久有效 + * @example $redis->persist('key'); + * @param string $key 键名 + * @return bool: + */ + public function persist(string $key): bool: + { + + } + + /** + * + *返回指定键的有效时间(秒) + * @example $redis->ttl('key'); + * @param string $key 键名 + * @return long + */ + public function ttl(string $key): long + { + + } + + /** + * + *返回指定键的有效时间(毫秒) + * @example $redis->pttl('key'); + * @param string $key 键名 + * @return long + */ + public function pttl(string $key): long + { + + } + + /** + * + *获取有序集合的成员数 + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zCard('key');            // 3
+     * 
+ * @param string $key 集合键名 + * @return int + */ + public function zcard(string $key): int + { + + } + + /** + * + *获取指定排序范围的成员数. + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zCount('key', 0, 3); // 2, corresponding to array('val0', 'val2')
+     * 
+ * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return int + */ + public function zcount(string $key, double $start, double $end): int + { + + } + + /** + * + *根据排序值范围来删除成员 + * @example + * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return long + */ + public function zremrangebyscore(string $key, double $start, double $end): long + { + + } + + /** + * + *获取指定成员的排序值(分数) + * @example + *
+     * $redis->zAdd('key', 2.5, 'val2');
+     * $redis->zScore('key', 'val2'); // 2.5
+     * 
+ * @param string $key 集合键名 + * @param string $member 成员值 + * @return double + */ + public function zscore(string $key, string $member): double + { + + } + + /** + * + *向有序集合插入元素 + * @example + *
+     * 
+     * $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' );  // int(2)
+     * $redis->zRem('z', 'v2', 'v3');                           // int(2)
+     * var_dump( $redis->zRange('z', 0, -1) );
+     * //// Output:
+     * // array(2) {
+     * //   [0]=> string(2) "v1"
+     * //   [1]=> string(2) "v4"
+     * // }
+     * 
+ *
+ * @param string $key 集合键名 + * @param double $score 排序值 + * @param string $value 元素值 + * @return int + */ + public function zadd(string $key, double $score, string $value): int + { + + } + + /** + * + *给有序集合成员增加排序值 + * @example + *
+     * $redis->delete('key');
+     * $redis->zIncrBy('key', 2.5, 'member1');  // key or member1 didn't exist, so member1's score is to 0
+     * // before the increment and now has the value 2.5
+     * $redis->zIncrBy('key', 1, 'member1');    // 3.5
+     * 
+ * @param string $key 目标集合键名 + * @param double $step 增加的步长 + * @param string $member 成员 + * @return float + */ + public function zincrby(string $key, double $step, string $member): float + { + + } + + /** + * + *获取字典的某个字段的值 + * @example + * @param string $key 键名 + * @param string $field 字段名 + * @return string + */ + public function hGet(string $key, string $field): string + { + + } + + /** + * + *为字典的字段设置值 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSet('h', 'key1', 'hello');  // 1, 'key1' => 'hello' in the hash at "h"
+     * $redis->hGet('h', 'key1');           // returns "hello"
+     * $redis->hSet('h', 'key1', 'plop');   // 0, value was replaced.
+     * $redis->hGet('h', 'key1');           // returns "plop"
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param string $value 字段值 + * @return long + */ + public function hSet(string $key, string $field, string $value): long + { + + } + + /** + * + *当字典的字段不存在时,为其设置值 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSetNx('h', 'key1', 'hello'); // TRUE, 'key1' => 'hello' in the hash at "h"
+     * $redis->hSetNx('h', 'key1', 'world'); // FALSE, 'key1' => 'hello' in the hash at "h". No change since the field
+     * wasn't replaced.
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param string $value 字段值 + * @return bool + */ + public function hSetNx(string $key, string $field, string $value): bool + { + + } + + /** + * + *删除字典的某个或某些字段 + * @example + *
+     * $redis->hMSet('h',
+     * array(
+     * 'f1' => 'v1',
+     * 'f2' => 'v2',
+     * 'f3' => 'v3',
+     * 'f4' => 'v4',
+     * ));
+     * var_dump( $redis->hDel('h', 'f1') );        // int(1)
+     * var_dump( $redis->hDel('h', 'f2', 'f3') );  // int(2)
+     * s
+     * var_dump( $redis->hGetAll('h') );
+     * //// Output:
+     * //  array(1) {
+     * //    ["f4"]=> string(2) "v4"
+     * //  }
+     * 
+ * @param string $key 键名 + * @param string|array $fields 字段名 + * @return int + */ + public function hDel(string $key, string $fields): int + { + + } + + /** + * + *获取字典的字段个数 + * @example + *
+     * $redis->delete('h')
+     * $redis->hSet('h', 'key1', 'hello');
+     * $redis->hSet('h', 'key2', 'plop');
+     * $redis->hLen('h'); // returns 2
+     * 
+ * @param string $key 键名 + * @return int + */ + public function hLen(string $key): int + { + + } + + /** + * + *获取字典的字段名称列表. + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hKeys('h'));
+     * // Output:
+     * // array(4) {
+     * // [0]=>
+     * // string(1) "a"
+     * // [1]=>
+     * // string(1) "b"
+     * // [2]=>
+     * // string(1) "c"
+     * // [3]=>
+     * // string(1) "d"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hKeys(string $key): array + { + + } + + /** + * + *获取字典的字段值列表 + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hVals('h'));
+     * // Output
+     * // array(4) {
+     * //   [0]=>
+     * //   string(1) "x"
+     * //   [1]=>
+     * //   string(1) "y"
+     * //   [2]=>
+     * //   string(1) "z"
+     * //   [3]=>
+     * //   string(1) "t"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hVals(string $key): array + { + + } + + /** + * + *获取字典所有字段键值对 + * @example + *
+     * $redis->delete('h');
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hSet('h', 'b', 'y');
+     * $redis->hSet('h', 'c', 'z');
+     * $redis->hSet('h', 'd', 't');
+     * var_dump($redis->hGetAll('h'));
+     * // Output:
+     * // array(4) {
+     * //   ["a"]=>
+     * //   string(1) "x"
+     * //   ["b"]=>
+     * //   string(1) "y"
+     * //   ["c"]=>
+     * //   string(1) "z"
+     * //   ["d"]=>
+     * //   string(1) "t"
+     * // }
+     * // The order is random and corresponds to redis' own internal representation of the set structure.
+     * 
+ * @param string $key 键名 + * @return array + */ + public function hGetAll(string $key): array + { + + } + + /** + * + *判断字典的某个字段是否存在. + * @example + *
+     * $redis->hSet('h', 'a', 'x');
+     * $redis->hExists('h', 'a');               //  TRUE
+     * $redis->hExists('h', 'NonExistingKey');  // FALSE
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @return bool + */ + public function hExists(string $key, string $field): bool + { + + } + + /** + * + *为指定字段增加指定的值. + * @example + *
+     * $redis->delete('h');
+     * $redis->hIncrBy('h', 'x', 2); // returns 2: h[x] = 2 now.
+     * $redis->hIncrBy('h', 'x', 1); // h[x] ← 2 + 1. Returns 3
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param int $step 自增步长 + * @return int + */ + public function hIncrBy(string $key, string $field, int $step): int + { + + } + + /** + * + *为指定字段增加指定的值 + * @example + *
+     * $redis = new Redis();
+     * $redis->connect('127.0.0.1');
+     * $redis->hset('h', 'float', 3);
+     * $redis->hset('h', 'int',   3);
+     * var_dump( $redis->hIncrByFloat('h', 'float', 1.5) ); // float(4.5)
+     * var_dump( $redis->hGetAll('h') );
+     * // Output
+     * array(2) {
+     * ["float"]=>
+     * string(3) "4.5"
+     * ["int"]=>
+     * string(1) "3"
+     * }
+     * 
+ * @param string $key 键名 + * @param string $field 字段名 + * @param double $step 自增步长 + * @return + */ + public function hIncrByFloat(string $key, string $field, double $step) + { + + } + + /** + * + *批量设置字典字段的值 + * @example + *
+     * $redis->delete('user:1');
+     * $redis->hMset('user:1', array('name' => 'Joe', 'salary' => 2000));
+     * $redis->hIncrBy('user:1', 'salary', 100); // Joe earns 100 more now.
+     * 
+ * @param string $key 键名 + * @param array $fields 字段键值对 + * @return boolean + */ + public function hMset(string $key, Array $fields): boolean + { + + } + + /** + * + *批量获取字典的字段值 + * @example + * @param string $key 键名 + * @param array $fields 字段名列表 + * @return array + */ + public function hMget(string $key, Array $fields): array + { + + } + + /** + * + *将某个键导出为一个二进制数据. + * @example + *
+     * $redis->set('foo', 'bar');
+     * $val = $redis->dump('foo'); // $val will be the Redis encoded key value
+     * 
+ * @param string $key 键名 + * @return string + */ + public function dump(string $key): string + { + + } + + /** + * + *获取成员的排序值 + * @example + *
+     * $redis->delete('z');
+     * $redis->zAdd('key', 1, 'one');
+     * $redis->zAdd('key', 2, 'two');
+     * $redis->zRank('key', 'one');     // 0
+     * $redis->zRank('key', 'two');     // 1
+     * $redis->zRevRank('key', 'one');  // 1
+     * $redis->zRevRank('key', 'two');  // 0
+     * 
+ * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRank(string $key, string $member): int + { + + } + + /** + * + *获取成员的排位值(倒数) + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zRevRank(string $key, string $member): int + { + + } + + /** + * + *键值自增 + * @example + *
+     * $redis->incr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value 1
+     * $redis->incr('key1'); // 2
+     * $redis->incr('key1'); // 3
+     * $redis->incr('key1'); // 4
+     * 
+ * @param string $key 键名 + * @return int + */ + public function incr(string $key): int + { + + } + + /** + * + *按指定步长自增 + * @example + *
+     * $redis->incr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value 1
+     * $redis->incr('key1');        // 2
+     * $redis->incr('key1');        // 3
+     * $redis->incr('key1');        // 4
+     * $redis->incrBy('key1', 10);  // 14
+     * 
+ * @param string $key 键名 + * @param int $step 自增步长 + * @return int + */ + public function incrBy(string $key, int $step): int + { + + } + + /** + * + *按指定步长自增 + * @example + *
+     * $redis = new Redis();
+     * $redis->connect('127.0.0.1');
+     * $redis->set('x', 3);
+     * var_dump( $redis->incrByFloat('x', 1.5) );   // float(4.5)
+     * // ! SIC
+     * var_dump( $redis->get('x') );                // string(3) "4.5"
+     * 
+ * @param string $key 键名 + * @param float $step 自增步长 + * @return float + */ + public function incrByFloat(string $key, float $step): float + { + + } + + /** + * + *键值自减 + * @example + *
+     * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1
+     * $redis->decr('key1'); // -2
+     * $redis->decr('key1'); // -3
+     * 
+ * @param string $key 键名 + * @return int + */ + public function decr(string $key): int + { + + } + + /** + * + *按指定步长自减 + * @example + *
+     * $redis->decr('key1');        // key1 didn't exists, set to 0 before the increment and now has the value -1
+     * $redis->decr('key1');        // -2
+     * $redis->decr('key1');        // -3
+     * $redis->decrBy('key1', 10);  // -13
+     * 
+ * @param string $key 键名 + * @param float $step 自减步长 + * @return int + */ + public function decrBy(string $key, float $step): int + { + + } + + /** + * + *设置键的有效期 + * @example + * @param string $key 键名 + * @param int $ttl 有效期(秒数) + * @return boolean + */ + public function expire(string $key, int $ttl): boolean + { + + } + + /** + * + *为某个键设置有效期为某个时间点 + * @example + *
+     * $redis->set('x', '42');
+     * $now = time(NULL);               // current timestamp
+     * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
+     * sleep(5);                        // wait 5 seconds
+     * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
+     * 
+ * @param string $key 键名 + * @param int $expireTime 到期时间 + * @return bool: + */ + public function expireAt(string $key, int $expireTime): bool: + { + + } + + /** + * + *设置键的有效期(毫秒为单位) + * @example + * @param string $key 键名 + * @param int $ttl 有效期(毫秒数) + * @return boolean + */ + public function pexpire(string $key, int $ttl): boolean + { + + } + + /** + * + *为某个键设置有效期为某个时间点(精确到毫秒) + * @example + *
+     * $redis->set('x', '42');
+     * $now = time(NULL);               // current timestamp
+     * $redis->expireAt('x', $now + 3); // x will disappear in 3 seconds.
+     * sleep(5);                        // wait 5 seconds
+     * $redis->get('x');                // will return `FALSE`, as 'x' has expired.
+     * 
+ * @param string $key 键名 + * @param int $expireTime 到期时间 + * @return bool: + */ + public function pexpireAt(string $key, int $expireTime): bool: + { + + } + + /** + * + *将字符串追加到键值后(返回值的长度) + * @example + *
+     * $redis->set('key', 'value1');
+     * $redis->append('key', 'value2'); // 12
+     * $redis->get('key');              // 'value1value2'
+     * 
+ * @param string $key 键名 + * @param string $value 追加的值 + * @return int + */ + public function append(string $key, string $value): int + { + + } + + /** + * + *获取某个键的某个位置的位值 + * @example + *
+     * $redis->set('key', "\x7f");  // this is 0111 1111
+     * $redis->getBit('key', 0);    // 0
+     * $redis->getBit('key', 1);    // 1
+     * 
+ * @param string $key 键名 + * @param int $offset 所在位置 + * @return int + */ + public function getBit(string $key, int $offset): int + { + + } + + /** + * + *修改某个键的某个位置的位值 + * @example + *
+     * $redis->set('key', "*");     // ord("*") = 42 = 0x2f = "0010 1010"
+     * $redis->setBit('key', 5, 1); // returns 0
+     * $redis->setBit('key', 7, 1); // returns 0
+     * $redis->get('key');          // chr(0x2f) = "/" = b("0010 1111")
+     * 
+ * @param string $key 键名 + * @param int $offset 开始位置 + * @param boolean|int $value 新值 + * @return int + */ + public function setBit(string $key, int $offset, int $value): int + { + + } + + /** + * + *多个键的位操作,并将结果存入到指定的键中 + * @example + * @param string $operation 操作(有 AND, OR, NOT, XOR 4种可选择) + * @param string $dstKey 目标键 + * @param string $key1 键名1 + * @param string $key2 键名2 + * @param string|... $keyN 键名N + * @return long + */ + public function bitop(string $operation, string $dstKey, string $key1, string $key2, string $keyN): long + { + + } + + /** + * + *统计字符串的位数 + * @example + * @param string $key 键名 + * @return long + */ + public function bitcount(string $key): long + { + + } + + /** + * + *获取指定位置的位值 + * @example + *
+     * $redis->set('key', '\xff\xff');
+     * $redis->bitpos('key', 1); // int(0)
+     * $redis->bitpos('key', 1, 1); // int(8)
+     * $redis->bitpos('key', 1, 3); // int(-1)
+     * $redis->bitpos('key', 0); // int(16)
+     * $redis->bitpos('key', 0, 1); // int(16)
+     * $redis->bitpos('key', 0, 1, 5); // int(-1)
+     * 
+ * @param string $key 键名 + * @param int $bit 位值 + * @param int $start 开始位置 + * @param int $end 结束位置 + * @return function + */ + public function bitpos(string $key, int $bit, int $start, int $end): function + { + + } + + /** + * + *获取列表中指定索引的值 + * @example + * @param string $key 键名 + * @param int $index 索引值 + * @return string | boolean + */ + public function lget(string $key, int $index): ?string + { + + } + + /** + * + *获取一个键值的子字符串 + * @example + *
+     * $redis->set('key', 'string value');
+     * $redis->getRange('key', 0, 5);   // 'string'
+     * $redis->getRange('key', -5, -1); // 'value'
+     * 
+ * @param string $key 键名 + * @param int $start 开始位置 + * @param int $end 结束位置 + * @return string: + */ + public function getrange(string $key, int $start, int $end): string: + { + + } + + /** + * + *删除指定范围外的其他元素 + * @example + * @param string $key 键名 + * @param int $start 开始索引 + * @param int $end 结束索引 + * @return array | boolean + */ + public function ltrim(string $key, int $start, int $end): ?array + { + + } + + /** + * + *获取列表指定范围的值 + * @example + * @param string $key 键名 + * @param int $start 索引开始值 + * @param int $end 索引结束值 + * @return array + */ + public function lrange(string $key, int $start, int $end): array + { + + } + + /** + * + *根据排序范围删除成员 + * @example + *
+     * $redis->zAdd('key', 1, 'one');
+     * $redis->zAdd('key', 2, 'two');
+     * $redis->zAdd('key', 3, 'three');
+     * $redis->zRemRangeByRank('key', 0, 1); // 2
+     * $redis->zRange('key', 0, -1, array('withscores' => TRUE)); // array('three' => 3)
+     * 
+ * @param string $key 集合键名 + * @param double $start 开始排序值 + * @param double $end 结束排序值 + * @return int + */ + public function zremrangebyrank(string $key, double $start, double $end): int + { + + } + + /** + * + *将消息发布到消息通道(队列). + * @example $redis->publish('chan-1', 'hello, world!'); // send message. + * @param string $channel 消息频道 + * @param string $message 消息 + * @return int + */ + public function publish(string $channel, string $message): int + { + + } + + /** + * + *给键重命名 + * @example + * @param string $srcKey 旧键名 + * @param string $dstKey 新键名 + * @return boolean + */ + public function rename(string $srcKey, string $dstKey): boolean + { + + } + + /** + * + *当目标键名不存在时,给键重命名 + * @example + * @param string $srcKey 旧键名 + * @param string $dstKey 新键名 + * @return boolean + */ + public function renamenx(string $srcKey, string $dstKey): boolean + { + + } + + /** + * + *将所有元素参数添加到 HyperLogLog 数据结构中 + * @example + * @param string $key 键名 + * @param string|array|... $element 元素 + * @return + */ + public function pfadd(string $key, string $element) + { + + } + + /** + * + *返回给定 HyperLogLog 的基数估算值 + * @example + * @param string|array $keys 键名 + * @return + */ + public function pfcount(string $keys) + { + + } + + /** + * + *将多个 HyperLogLog 合并为一个 HyperLogLog ,合并后的 HyperLogLog 的基数估算值是通过对所有 给定 HyperLogLog 进行并集计算得出的 + * @example + * @param string|array $dstKey 目标键名 + * @param string|array $sourceKeys 源键名 + * @return + */ + public function pfmerge(string $dstKey, string $sourceKeys) + { + + } + + /** + * + *修改某个键的某个位置的值 + * @example + *
+     * $redis->set('key', 'Hello world');
+     * $redis->setRange('key', 6, "redis"); // returns 11
+     * $redis->get('key');                  // "Hello redis"
+     * 
+ * @param string $key 键名 + * @param int $offset 开始位置 + * @param string $value 被替换的子串的值 + * @return string + */ + public function setrange(string $key, int $offset, string $value): string + { + + } + + /** + * + *将dump导出的二进制数据恢复到可读的字符串. + * @example + *
+     * $redis->set('foo', 'bar');
+     * $val = $redis->dump('foo');
+     * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
+     * 
+ * @param string $key 键名 + * @param int $ttl 有效期 + * @param string $value dump导出的二进制数据 + * @return + */ + public function restore(string $key, int $ttl, string $value) + { + + } + + /** + * + *将某个集合中的元素移动到另外一个集合中 + * @example + *
+     * $redis->sAdd('key1' , 'set11');
+     * $redis->sAdd('key1' , 'set12');
+     * $redis->sAdd('key1' , 'set13');          // 'key1' => {'set11', 'set12', 'set13'}
+     * $redis->sAdd('key2' , 'set21');
+     * $redis->sAdd('key2' , 'set22');          // 'key2' => {'set21', 'set22'}
+     * $redis->sMove('key1', 'key2', 'set13');  // 'key1' =>  {'set11', 'set12'}
+     * // 'key2' =>  {'set21', 'set22', 'set13'}
+     * 
+ * @param string $srcKey 原集合键名 + * @param string $dstKey 目标集合键名 + * @param string $member 成员 + * @return bool + */ + public function smove(string $srcKey, string $dstKey, string $member): bool + { + + } + + /** + * + *获取有序集合中指定范围的成员 + * @example + *
+     * $redis->zAdd('key1', 0, 'val0');
+     * $redis->zAdd('key1', 2, 'val2');
+     * $redis->zAdd('key1', 10, 'val10');
+     * $redis->zRange('key1', 0, -1); // array('val0', 'val2', 'val10')
+     * // with scores
+     * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param boolean $withScores 是否返回成员的排序值 + * @return array + */ + public function zRange(string $key, long $start, long $end, boolean $withScores): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(倒序排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRevRange('key', 0, -1); // array('val10', 'val2', 'val0')
+     * // with scores
+     * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param boolean $withScores 是否返回成员的排序值 + * @return array + */ + public function zRevRange(string $key, long $start, long $end, boolean $withScores): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(按排序值排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param array $options 附加选项(可以是:withscores => TRUE, and limit => array($offset, $count)) + * @return array + */ + public function zRangeByScore(string $key, long $start, long $end, Array $options): array + { + + } + + /** + * + *获取有序集合中指定范围的成员(按排序值倒序排列) + * @example + *
+     * $redis->zAdd('key', 0, 'val0');
+     * $redis->zAdd('key', 2, 'val2');
+     * $redis->zAdd('key', 10, 'val10');
+     * $redis->zRangeByScore('key', 0, 3);                                          // array('val0', 'val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE);              // array('val0' => 0, 'val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2' => 2)
+     * $redis->zRangeByScore('key', 0, 3, array('limit' => array(1, 1));                        // array('val2')
+     * $redis->zRangeByScore('key', 0, 3, array('withscores' => TRUE, 'limit' => array(1, 1));  // array('val2' => 2)
+     * 
+ * @param string $key 集合键名 + * @param long $start 索引开始值 + * @param long $end 索引结束值 + * @param array $options 附加选项(可以是:withscores => TRUE, and limit => array($offset, $count)) + * @return array + */ + public function zRevRangeByScore(string $key, long $start, long $end, Array $options): array + { + + } + + /** + * + *按字母字典的顺序返回成员 + * @example + *
+     * foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
+     * $redis->zAdd('key', $char);
+     * }
+     * $redis->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
+     * $redis->zRangeByLex('key', '-', '(c'); // array('a', 'b')
+     * $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
+     * 
+ * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @param long $offset 索引开始值 + * @param long $limit 成员数 + * @return array + */ + public function zRangeByLex(string $key, long $min, long $max, long $offset, long $limit): array + { + + } + + /** + * + *按字母字典的顺序返回成员(倒序排序) + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @param long $offset 索引开始值 + * @param long $limit 成员数 + * @return + */ + public function zRevRangeByLex(string $key, long $min, long $max, long $offset, long $limit) + { + + } + + /** + * + *获取指定字母范围的成员数 + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @return int + */ + public function zlexcount(string $key, long $min, long $max): int + { + + } + + /** + * + *删除指定字母范围的成员 + * @example + * @param string $key 集合键名 + * @param long $min 最小的字母 + * @param long $max 最大的字母 + * @return long + */ + public function zremrangebylex(string $key, long $min, long $max): long + { + + } + + /** + * + *将两个有序集合的并集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k2', 2, 'val2');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zUnion('ko1', array('k1', 'k2')); // 4, 'ko1' => array('val0', 'val1', 'val2', 'val3')
+     * // Weighted zUnion
+     * $redis->zUnion('ko2', array('k1', 'k2'), array(1, 1)); // 4, 'ko2' => array('val0', 'val1', 'val2', 'val3')
+     * $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko3' => array('val0', 'val2', 'val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zunionstore(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *将两个有序集合的交集存入到一个指定的键中 + * @example + *
+     * $redis->delete('k1');
+     * $redis->delete('k2');
+     * $redis->delete('k3');
+     * $redis->delete('ko1');
+     * $redis->delete('ko2');
+     * $redis->delete('ko3');
+     * $redis->delete('ko4');
+     * $redis->zAdd('k1', 0, 'val0');
+     * $redis->zAdd('k1', 1, 'val1');
+     * $redis->zAdd('k1', 3, 'val3');
+     * $redis->zAdd('k2', 2, 'val1');
+     * $redis->zAdd('k2', 3, 'val3');
+     * $redis->zInter('ko1', array('k1', 'k2'));               // 2, 'ko1' => array('val1', 'val3')
+     * $redis->zInter('ko2', array('k1', 'k2'), array(1, 1));  // 2, 'ko2' => array('val1', 'val3')
+     * // Weighted zInter
+     * $redis->zInter('ko3', array('k1', 'k2'), array(1, 5), 'min'); // 2, 'ko3' => array('val1', 'val3')
+     * $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
+     * 
+ * @param string $dstKey 目标集合键名 + * @param array $zsetKeys 集合键名 + * @param array $zsetKeysWeight 集合键对应的权重 + * @param string $aggregateFunction 合并使用的函数(SUM, MIN, 或 MAX) + * @return int + */ + public function zinterstore(string $dstKey, Array $zsetKeys, Array $zsetKeysWeight, string $aggregateFunction): int + { + + } + + /** + * + *删除有序集合中的某个成员 + * @example + * @param string $key 集合键名 + * @param string $member 成员值 + * @return int + */ + public function zrem(string $key, string $member): int + { + + } + + /** + * + *给列表、集合或有序集合的元素排序 + * @example + *
+     * $redis->delete('s');
+     * $redis->sadd('s', 5);
+     * $redis->sadd('s', 4);
+     * $redis->sadd('s', 2);
+     * $redis->sadd('s', 1);
+     * $redis->sadd('s', 3);
+     * var_dump($redis->sort('s')); // 1,2,3,4,5
+     * var_dump($redis->sort('s', array('sort' => 'desc'))); // 5,4,3,2,1
+     * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5
+     * 
+ * @param string $key 键名 + * @param array $options 排序参数,如:array('sort' => 'desc') + * @return An + */ + public function sort(string $key, Array $options): An + { + + } + + /** + * + *获取某个键的对象信息 + * @example + *
+     * $redis->object("encoding", "l"); // → ziplist
+     * $redis->object("refcount", "l"); // → 1
+     * $redis->object("idletime", "l"); // → 400 (in seconds, with a precision of 10 seconds).
+     * 
+ * @param string $info 获取的信息指标名称(有 encoding、refcount 、idletime 3种可选择) + * @param string $key 键名 + * @return string + */ + public function object(string $info, string $key): string + { + + } + + /** + * + *订阅消息 + * @example + *
+     * function f($redis, $chan, $msg) {
+     * switch($chan) {
+     * case 'chan-1':
+     * ...
+     * break;
+     * case 'chan-2':
+     * ...
+     * break;
+     * case 'chan-2':
+     * ...
+     * break;
+     * }
+     * }
+     * $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
+     * 
+ * @param array $channels 订阅的消息频道 + * @param string|array $callback 回调函数名称 + * @param mixed $value 返回值 + * @return mixed + */ + public function subscribe(Array $channels, string $callback, $value) + { + + } + + /** + * + *通过匹配模式来订阅这些匹配的消息频道 + * @example + *
+     * function psubscribe($redis, $pattern, $chan, $msg) {
+     * echo "Pattern: $pattern\n";
+     * echo "Channel: $chan\n";
+     * echo "Payload: $msg\n";
+     * }
+     * 
+ * @param array $patterns 匹配模式 + * @param string|array $callback 回调函数名称 + * @param mixed $value 返回值 + * @return + */ + public function psubscribe(Array $patterns, string $callback, $value) + { + + } + + /** + * + *取消订阅 + * @example + * @param array $channels 订阅的消息频道 + * @return + */ + public function unsubscribe(Array $channels) + { + + } + + /** + * + *通过匹配模式来取消订阅这些匹配的消息频道 + * @example + * @param array $patterns 匹配模式 + * @return + */ + public function punsubscribe(Array $patterns) + { + + } + + /** + * + *执行lua脚本 + * @example + * @param string $script 脚本 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return mixed + */ + public function eval(string $script, Array $args, int $num_keys) + { + + } + + /** + * + *从脚本的SHA1散列而不是脚本本身执行LUA脚本 + * @example $script = 'return 1'; + * $sha = $redis->script('load', $script); + * $redis->evalSha($sha); // Returns 1 + * @param string $script_sha 脚本的散列值 + * @param array $args 脚本参数 + * @param int $num_keys 应该进入KEYS数组的参数个数 + * @return + */ + public function evalsha(string $script_sha, Array $args, int $num_keys) + { + + } + + /** + * + *扫描键空间. + * @example + *
+     * $iterator = null;
+     * while($keys = $redis->scan($iterator)) {
+     * foreach($keys as $key) {
+     * echo $key . PHP_EOL;
+     * }
+     * }
+     * 
+ * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return array + */ + public function scan(Long $i_iterator, string $str_pattern, int $i_count): array + { + + } + + /** + * + *扫描hash的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function hscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *扫描有序集合的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function zscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *扫描集合的键 + * @example + * @param string $str_key 键值 + * @param Long|NULL $i_iterator 迭代器 + * @param string $str_pattern 匹配的模式 + * @param int $i_count 每次迭代的长度 + * @return + */ + public function sscan(string $str_key, Long $i_iterator, string $str_pattern, int $i_count) + { + + } + + /** + * + *获取运行模式,如 ATOMIC/MULTI/PIPELINE + * @example $redis->getMode(); + * @return int + */ + public function getmode(): int + { + + } + + /** + * + *获取上次错误信息 + * @example + *
+     * $redis->eval('this-is-not-lua');
+     * $err = $redis->getLastError();
+     * // "ERR Error compiling script (new function): user_script:1: '=' expected near '-'"
+     * 
+ * @return string + */ + public function getLastError(): string + { + + } + + /** + * + *清除上次错误信息 + * @example + *
+     * $redis->set('x', 'a');
+     * $redis->incr('x');
+     * $err = $redis->getLastError();
+     * // "ERR value is not an integer or out of range"
+     * $redis->clearLastError();
+     * $err = $redis->getLastError();
+     * // NULL
+     * 
+ * @return bool + */ + public function clearLastError(): bool + { + + } + + /** + * + *获取客户端选项 + * @example + * // return Redis::SERIALIZER_NONE, Redis::SERIALIZER_PHP, or Redis::SERIALIZER_IGBINARY. + * $redis->getOption(Redis::OPT_SERIALIZER); + * @param string $optionName 选项名 + * @return int + */ + public function getOption(string $optionName): int + { + + } + + /** + * + *设置客户端选项. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);        // don't serialize data
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);         // use built-in serialize/unserialize
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);    // use igBinary serialize/unserialize
+     * $redis->setOption(Redis::OPT_PREFIX, 'myAppName:');                      // use custom prefix on all keys
+     * 
+ * @param string $optionName 选项名 + * @param string $optionValue 选项值 + * @return bool: + */ + public function setOption(string $optionName, string $optionValue): bool: + { + + } + + /** + * + *设置键前缀 + * @example + *
+     * $redis->setOption(Redis::OPT_PREFIX, 'my-prefix:');
+     * $redis->_prefix('my-value'); // Will return 'my-prefix:my-value'
+     * 
+ * @param string $prefix 前缀 + * @return string + */ + public function _prefix(string $prefix): string + { + + } + + /** + * + *用于手动序列化. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
+     * $redis->_serialize("foo"); // returns "foo"
+     * $redis->_serialize(Array()); // Returns "Array"
+     * $redis->_serialize(new stdClass()); // Returns "Object"
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+     * $redis->_serialize("foo"); // Returns 's:3:"foo";'
+     * 
+ * @param string $value 被序列化的值 + * @return + */ + public function _serialize(string $value) + { + + } + + /** + * + *反序列化方法. + * @example + *
+     * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
+     * $redis->_unserialize('a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}'); // Will return Array(1,2,3)
+     * 
+ * @param string $value 被反序列化的值 + * @return + */ + public function _unserialize(string $value) + { + + } + + /** + * + *获取集群中的主服务器列表 + * @example foreach ($obj_cluster->_masters() as $arr_master) { + * $obj_cluster->echo($arr_master, "Hello: " . implode(':', $arr_master)); + * } + * @return array + */ + public function _masters(): array + { + + } + + /** + * + *获取跳转的地址,格式为:host:port + * @example + * @return string|NULL + */ + public function _redir(): ?string + { + + } + + /** + * + *开始一个事务. + * @example + *
+     * $ret = $redis->multi()
+     * ->set('key1', 'val1')
+     * ->get('key1')
+     * ->set('key2', 'val2')
+     * ->get('key2')
+     * ->exec();
+     * //$ret == array (
+     * //    0 => TRUE,
+     * //    1 => 'val1',
+     * //    2 => TRUE,
+     * //    3 => 'val2');
+     * 
+ * @return + */ + public function multi() + { + + } + + /** + * + *取消事务 + * @example + * @return + */ + public function discard() + { + + } + + /** + * + *执行事务 + * @example + * @return + */ + public function exec() + { + + } + + /** + * + *观察某个键在其他客户端的变化情况. + * @example + *
+     * $redis->watch('x');
+     * // long code here during the execution of which other clients could well modify `x`
+     * $ret = $redis->multi()
+     * ->incr('x')
+     * ->exec();
+     * // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
+     * 
+ * @param string|array $keys 键名 + * @return + */ + public function watch(string $keys) + { + + } + + /** + * + *取消观察某个键在其他客户端的变化情况 + * @example + * @param string|array $keys 键名 + * @return + */ + public function unwatch(string $keys) + { + + } + + /** + * + *将数据同步到硬盘上 + * @example $redis->save(); + * @return boolean + */ + public function save(): boolean + { + + } + + /** + * + *将数据存入到硬盘上(异步操作) + * @example + * @return + */ + public function bgSave() + { + + } + + /** + * + *删除当前数据库的所有键 + * @example $redis->flushDB(); + * @return bool + */ + public function flushdb(): bool + { + + } + + /** + * + *删除当前实例的所有键 + * @example $redis->flushAll(); + * @return bool + */ + public function flushall(): bool + { + + } + + /** + * + *获取当前数据库的键的个数 + * @example + *
+     * $count = $redis->dbSize();
+     * echo "Redis has $count keys\n";
+     * 
+ * @return int + */ + public function dbsize(): int + { + + } + + /** + * + *开启后台写AOF日志操作 + * @example $redis->bgrewriteaof(); + * @return bool + */ + public function bgrewriteaof(): bool + { + + } + + /** + * + *获取上次数据同步到硬盘的时间 + * @example $redis->lastSave(); + * @return int + */ + public function lastsave(): int + { + + } + + /** + * + *获取Redis服务器的信息和统计数据 + * @example + *
+     * $redis->info();
+     * or
+     * $redis->info("COMMANDSTATS"); //Information on the commands that have been run (>=2.6 only)
+     * $redis->info("CPU"); // just CPU information from Redis INFO
+     * 
+ * @return array + */ + public function info(): array + { + + } + + /** + * + *返回当前连接的服务器的角色,如master、alone、slave、sentinel + * @example + * @return string + */ + public function role(): string + { + + } + + /** + * + *返回当前redis服务器时间. + * @example + *
+     * var_dump( $redis->time() );
+     * // array(2) {
+     * //   [0] => string(10) "1342364352"
+     * //   [1] => string(6) "253002"
+     * // }
+     * 
+ * @return int + */ + public function time(): int + { + + } + + /** + * + *返回一个随机的键 + * @example + *
+     * $key = $redis->randomKey();
+     * $surprise = $redis->get($key);  // who knows what's in there.
+     * 
+ * @return string + */ + public function randomkey(): string + { + + } + + /** + * + *检查当前redis连接状态(成功时返回PONG) + * @example + * @return string + */ + public function ping(): string + { + + } + + /** + * + *向redis发送一个字符串,而且redis服务器将返回一个相同的字符串 + * @example + * @param string $str 发送的字符串 + * @return string + */ + public function echo(string $str): string + { + + } + + /** + * + *获取所有命令列表 + * @example + * @return array + */ + public function command(): array + { + + } + + /** + * + *在redis服务器上执行命令 + * @example + * @param string $command 执行的命令 + * @param string|array $args 参数 + * @return + */ + public function rawcommand(string $command, string $args) + { + + } + + /** + * + *获取集群节点信息 + * @example + * @param string $args 参数(目前只支持slots) + * @return array + */ + public function cluster(string $args): array + { + + } + + /** + * + *获取客户端相关参数或进行相关操作 + * @example + * @param string $command 命令(CLIENT LIST +CLIENT GETNAME +CLIENT SETNAME [name] +CLIENT KILL [ip:port] +) + * @param string $args 参数 + * @return + */ + public function client(string $command, string $args) + { + + } + + /** + * + *获取或设置配置项. + * @example + *
+     * $redis->config("GET", "*max-*-entries*");
+     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
+     * 
+ * @param string $operation 操作(SET或GET) + * @param string $key 配置项或配置项匹配模式 + * @param string $value 配置值 + * @return array + */ + public function config(string $operation, string $key, string $value): array + { + + } + + /** + * + *查看订阅与发布系统状态,它由数个不同格式的子命令组成. + * @example + *
+     * $redis->pubsub('channels'); // All channels
+     * $redis->pubsub('channels', '*pattern*'); // Just channels matching your pattern
+     * $redis->pubsub('numsub', array('chan1', 'chan2')); // Get subscriber counts for 'chan1' and 'chan2'
+     * $redis->pubsub('numpat'); // Get the number of pattern subscribers
+     * 
+ * @param string $subcommand 子命令(可以是channels, numsub, numpat) + * @param string|array $args 参数 + * @return array|int + */ + public function pubsub(string $subcommand, string $args): ?array + { + + } + + /** + * + *在脚本子系统上执行redis命令 + * @example + *
+     * $redis->script('load', $script);
+     * $redis->script('flush');
+     * $redis->script('kill');
+     * $redis->script('exists', $script1, [$script2, $script3, ...]);
+     * 
+ * SCRIPT LOAD will return the SHA1 hash of the passed script on success, and FALSE on failure. + * SCRIPT FLUSH should always return TRUE + * SCRIPT KILL will return true if a script was able to be killed and false if not + * SCRIPT EXISTS will return an array with TRUE or FALSE for each passed script + * @param string $command redis命令 + * @param string|... $script 脚本 + * @return + */ + public function script(string $command, string $script) + { + + } + + /** + * + *获取慢操作日志 + * @example + * @param string $command 执行的命令 + * @param int $length 获取条目数 + * @return + */ + public function slowlog(string $command, int $length) + { + + } + +} + diff --git a/data/output/Redis/RedisClusterException.php b/data/output/Redis/RedisClusterException.php new file mode 100644 index 0000000..b180100 --- /dev/null +++ b/data/output/Redis/RedisClusterException.php @@ -0,0 +1,166 @@ +