Commit a4a0ed5
committed
Initial commit of refactored command construction
This commit adds a new printf like command construction function
with additionaly format specifiers specific to phpredis. Because
phpredis can be configured to automatically prefix keys and/or
automatically serialize values we had a great deal of redundant
boilerplate code.
zend_parse_paramaters(..., "sz", &key, &keylen, &z_arg);
keyfree = redis_key_prefix(redis_sock, &key, &keylen);
valfree = redis_serialize(redis_sock, z_val, &realval, &reallen);
/* More processing */
if (keyfree) efree(key);
if (valfree) efree(val);
Now it is possible to use redis_spprintf and use format specifiers
specific to these tasks, which will handle prefixing or serialization
(as well as memory cleanup) automatically:
/* The library function will automatically prefix and serialize values
if phpredis has been configured to do that */
len = phpredis_spprintf(redis_sock, slot TRMLS_CC, "SET", "kv", key,
key_len, z_value);1 parent 9ec9aed commit a4a0ed5
File tree
5 files changed
+354
-576
lines changed5 files changed
+354
-576
lines changed
0 commit comments