|
@@ -314,6 +314,12 @@ modparam("ndb_redis", "flush_on_reconnect", 1)
|
|
|
* value[n] - returns value of the nth element. value - returns null
|
|
|
for an array. You need to get each element by index.
|
|
|
|
|
|
+ In case one of the members of the array is also an array (for example
|
|
|
+ calling SMEMBERS in a MULTI/EXEC transaction), the members of the array
|
|
|
+ can be accessed by adding any of the above keys, after a value[n] key.
|
|
|
+ The first value[n] references the element in the first array, while the
|
|
|
+ next key references an element of the referenced array.
|
|
|
+
|
|
|
Example 1.9. redis_cmd usage
|
|
|
...
|
|
|
if(redis_cmd("srvN", "INCR cnt", "r")) {
|
|
@@ -344,6 +350,16 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
|
|
|
xlog("array size: $redis(r=>size)\n");
|
|
|
xlog("first values: $redis(r=>value[0]) , $redis(r=>value[1])\n");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+# array as element of an array example
|
|
|
+redis_cmd("srvN", "MULTI", "r1");
|
|
|
+redis_cmd("srvN", "SMEMBERS foo", "r2");
|
|
|
+if (redis_cmd("srvN", "EXEC", "r")) {
|
|
|
+ xlog("array size: $redis(r=>value[0]=>size)\n");
|
|
|
+ xlog("first member of the set:$redis(r=>value[0]=>value[0])\n");
|
|
|
+ xlog("type of the second member of the set:$redis(r=>value[0]=>type[1])\n");
|
|
|
+}
|
|
|
...
|
|
|
|
|
|
4.2. redis_pipe_cmd(srvname, command, ..., replyid)
|