Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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);
- Loading branch information