This commit updates ZPOPMIN/ZPOPMAX to return the same format that
zRange WITHSCORES and zRangeByScore WITHSCORES does.
In addition the blocking variants BZPOPMIN and BZPOPMAX are implemented.
PHP 7 removed TSRMLS_CC from zend_throw_exception* routines.
Additionally this commit creates two simple wrapper macros for throwing
Redis or RedisCluster exceptions so we don't duplicate as much code.
Additionally there were a couple of minor compiler warnings printf type
correctness fixed in this commit.
This commit removes support for PHP 5 by getting rid of all of our Zend
compatibility layer methods, as well as any call checking against
PHP_MAJOR_VERSION or ZEND_MODULE_API_NO.
Unit tests are all passing for Redis, RedisCluster, and RedisArray but
this should still be considered a work in progress until more testing
can be done.
Addresses issue #1448
This should fix the XCLAIM issue on 32-bit PHP installs.
This change will allow the user to pass the XCLAIM TIME option pretty much any way they want (string, long, or float) and it should work. Note that in 32-bit PHP they will only be able to pass exact values <= 2^53 as PHP will use a double precision floating point for integer overflows.
* Adds the STORE and STOREDIST options to GEORADIUS[BYMEMBER] for
both Redis and RedisCluster classes. We attempt to protect the
caller from CROSSLOT errors on the client side so as to make it
obvious when that is happening.
* Created a struct to carry around GEORADIUS options as there are
now two more and there were already a lot.
* Moved the structs/enums to handle GEORADIUS into the source file
instead of header as they aren't needed outside of redis_commands.c
This commit implements UNLINK for Redis, RedisCluster, and RedisArray.
To a client library UNLINK behaves identically to DEL so we can use the
same handlers for both.
While testing example code for Geo codes I discovered that passing
a negative count would cause PhpRedis to hang as it would send an
invalid number of arguments to the server.
This commit is adding support of data compression.
LZF was choosen because it small and fast and Redis server uses it.
Since [pecl package](https://pecl.php.net/package/lzf) doesn't provide
lzf.h file after installing, LZF library was added as submodule.
Another algorythms may be easely added by analogy with serializers.
TODO: unit-tests for different data types.
Move building `script` command logic to `redis_build_script_cmd`
and use it in Redis and RedisCluster objects.
Fix arginfo for `RedisCluster::script`.
Fix memory leak in `cluster_raw_cmd` when `cluster_cmd_get_slot` fails.
This commit moves EVAL and EVALSHA command construction to our
redis_commands.c file because as with many other commands we
can share the logic between Redis and RedisCluster.
In addition it removes the last call to the legacy formatting
function redis_cmd_format() which can now be removed.
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);