[sr-dev] git:master: ndb_redis: redis_cmd variadic function documentation.

Vicente Hernando vhernando at systemonenoc.com
Tue Jul 10 12:07:25 CEST 2012


Module: sip-router
Branch: master
Commit: 1010594cf1d7df4753a61142dc86d7d04f6c4be3
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1010594cf1d7df4753a61142dc86d7d04f6c4be3

Author: Vicente Hernando <vhernando at systemonenoc.com>
Committer: Vicente Hernando <vhernando at systemonenoc.com>
Date:   Tue Jul 10 05:54:00 2012 -0400

ndb_redis: redis_cmd variadic function documentation.

---

 modules/ndb_redis/doc/ndb_redis_admin.xml |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/modules/ndb_redis/doc/ndb_redis_admin.xml b/modules/ndb_redis/doc/ndb_redis_admin.xml
index ec48d7f..51d5706 100644
--- a/modules/ndb_redis/doc/ndb_redis_admin.xml
+++ b/modules/ndb_redis/doc/ndb_redis_admin.xml
@@ -100,15 +100,20 @@ modparam("ndb_redis", "server", "name=srvY;unix=/tmp/redis.sock;db=3")
 	<title>Functions</title>
 	<section>
 	    <title>
-		<function moreinfo="none">redis_cmd(srvname, command, replyid)</function>
+		<function moreinfo="none">redis_cmd(srvname, command, ..., replyid)</function>
 	    </title>
 	    <para>
 			Send a command to REDIS server identified by srvname. The reply will
-			be stored in a local continer identified by replyid. All the
+			be stored in a local container identified by replyid. All the
 			parameters can be strings with pseudo-variables that are evaluated
 			at runtime.
 		</para>
 		<para>
+			Minimum required arguments are srvname, command and replyid. Command argument
+			can be separated into several ones using %s token. (See examples)
+			Total number of arguments cannot exceed six.
+		</para>
+		<para>
 			The reply can be accessed via pseudo-variable $redis(key). The key
 			can be: type - type of the reply (as in hiredis.h); value - the value
 			returned by REDIS server; info - in case of error from REDIS, it will
@@ -154,6 +159,16 @@ redis_cmd("srvN", "SET ruri $ru", "r");
 # get a value
 redis_cmd("srvN", "GET foo", "r");
 
+# same command separated into two arguments:
+redis_cmd("srvN", "GET %s", "foo", "r");
+
+# if we have a key with spaces within it:
+redis_cmd("srvN", "GET %s", "foo bar", "r");
+
+# several values substitution:
+redis_cmd("srvN", "HMGET %s %s %s", "key1", "field1", "field2", "r");
+
+
 # array example
 if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
     xlog("array size: $redis(r=>size)\n");




More information about the sr-dev mailing list