375 Commits

Author SHA1 Message Date
B. Gortney d5b8f83340 rebase msgpack pull request (#801) on develop branch 2019-03-23 16:55:43 +02:00
michael-grunder eb81b9153c Merge branch 'issue-1509' into issue.1448-require_php7 2019-02-23 17:41:19 -08:00
michael-grunder 2ec7d91a7b Remove dead code, fix min_argc for blocking commands 2019-02-19 07:55:34 -08:00
michael-grunder f89e941a88 Change ZPOP* return type and implement blocking variants
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.
2019-02-18 20:00:08 -08:00
michael-grunder 85419ce7d3 Merge branch 'issue.1502.geo-readonly-cmds' into issue.1448-require_php7 2019-02-14 10:21:00 -08:00
michael-grunder 22d81a94ee Implement GEORADIUS_RO and GEORADIUSBYMEMBER_RO
This addresses #1502, #1487
2019-02-13 13:07:35 -08:00
michael-grunder fa130a4bd4 PHP 7 exception and compiler warning fixes
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.
2019-02-08 21:31:47 -08:00
michael-grunder f9928642b5 PHP 5 is dead, long live PHP 7
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
2019-01-26 20:57:16 -08:00
Michael Grunder 15995c06e3 Xgroup updates (#1499)
Adds support for XGROUP CREATE ... MKSTREAM, and support at all for XGROUP DESTROY.
2019-01-24 08:36:58 -08:00
michael-grunder eb8bcc1de8 Comment fix: No longer always success 2018-11-06 09:00:55 -08:00
Michael Grunder 18dc2aacd6 32bit xclaim fix (#1444)
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.
2018-11-06 08:46:02 -08:00
Pavlo Yatsukhnenko bfa6170001 Fix scan-build warnings 2018-10-01 09:44:47 +03:00
Michael Grunder 2c9e057236 Streams (#1413)
Streams API
2018-09-29 11:59:01 -07:00
michael-grunder d4a086979f Allow '-' and '+' arguments and add tests for zLexCount and zRemRangeByLex 2018-09-18 17:00:21 -07:00
Pavlo Yatsukhnenko beb6e8f3ab Issue #1302
Handle async parameter for Redis::flushDb and Redis::flushAll
TODO: implementation for RedisArray and RedisCluster
2018-04-22 22:23:35 +03:00
michael-grunder a53d5db622 Consistent options variable name 2018-04-10 12:07:06 -07:00
michael-grunder 411b6aa5b1 Adds STORE and STOREDIST to GEORADIUS[BYMEMBER]
* 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
2018-04-10 12:07:06 -07:00
michael-grunder a4afe91909 Some style normalization 2018-02-17 09:47:28 -08:00
michael-grunder 625fadeb51 Merge branch 'swapdb-command' into develop 2018-01-18 17:38:09 -08:00
michael-grunder 84f1f28ba2 Implement SWAPDB command 2018-01-18 09:04:25 -08:00
michael-grunder 04f62acbc8 Syntax fixes and prototype consolidation
Fix PHP_METHOD syntax fail for unlink
Move redis_unlink_cmd by redis_del_cmd as they're the same
2018-01-17 10:34:08 -08:00
michael-grunder 9e65c42931 Implement UNLINK command
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.
2018-01-17 09:36:38 -08:00
michael-grunder 51e48729df Shot in the dark fix for TCP_KEEPALIVE in Windows 2017-10-26 09:27:46 -07:00
michael-grunder 010336d5a7 Tweak call to setsockopt in redis_setoption_handler 2017-10-24 14:57:03 -07:00
michael-grunder 29ecb04981 Merge remote-tracking branch 'git-hulk/feature/tcp-keepalive' into develop 2017-10-24 13:42:02 -07:00
git-hulk 68c5851318 MOD: Add tcp_keepalive option to redis sock 2017-10-24 14:44:11 +08:00
michael-grunder f7edee5d8b More robust GEORADIUS COUNT validation
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.
2017-10-22 18:48:02 -07:00
Pavlo Yatsukhnenko 8cb2d5bd94 Issue #1048
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.
2017-10-17 17:08:42 +03:00
Pavlo Yatsukhnenko cb003239a6 Issue #1245
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.
2017-10-05 10:03:30 +03:00
Pavlo Yatsukhnenko 99335d6081 Don't use convert_to_string in redis_hmget_cmd 2017-09-29 17:19:45 +03:00
michael-grunder cccc3997e9 Update EXISTS to handle multiple keys
Fixes #1223
2017-08-20 13:28:00 -07:00
Pavlo Yatsukhnenko 2bf7b2f714 Use zend_string to store strings in RedisSock
Following fields were changed: err, prefix, persistent_id, auth and host
2017-08-16 16:58:10 +03:00
Pavlo Yatsukhnenko 4452f6858b Use ZEND_HASH_FOREACH_VAL in redis_sort_cmd 2017-08-11 16:45:21 +03:00
Pavlo Yatsukhnenko 4e32254ec2 Use ZSTR_VAL and ZSTR_LEN macroses to access zend_string fields 2017-08-02 13:20:30 +03:00
Pavlo Yatsukhnenko 4766c257a3 CID 157199 2017-07-20 23:38:38 +03:00
Pavlo Yatsukhnenko ad45964150 Using ZVAL_DEREF macros for dereference input variables.
This PR fixes issues #946 and #1166.
2017-05-09 23:17:20 +03:00
michael-grunder 51ceaed8de Merge branch 'resp-printf' into develop 2017-05-01 20:16:54 -07:00
michael-grunder b3d00dd390 Replace redis_cmd_format_static with redis_spprintf 2017-04-28 15:56:07 -07:00
michael-grunder 0eaeae0f46 Replace redis_cmd_format_static with redis_spprintf 2017-04-28 12:30:58 -07:00
michael-grunder a5a0b08f4e Refactore EVAL command
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.
2017-04-27 22:30:47 -07:00
Pavlo Yatsukhnenko ba0070dbf9 Allow using numeric string in zinter command 2017-04-27 17:28:51 +03:00
michael-grunder d750813e3f Rewrite generic mset to use newer methods 2017-04-26 22:20:11 -07:00
michael-grunder a4a0ed5f8a 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);
2017-04-26 16:55:20 -07:00
michael-grunder 30462b86f6 Pass prefixed key not original 2017-04-22 21:56:51 -07:00
michael-grunder 9aa3dbfc3d Allow MIGRATE to accept multiple keys 2017-04-22 21:45:08 -07:00
michael-grunder d2e203a630 Adds optional COUNT argument to sPop
Fixes #1145
2017-04-16 21:21:31 -07:00
Pavlo Yatsukhnenko 18149e34e4 refactoring (#1140)
* refactoring

* Fix read_timeout
2017-04-01 12:12:47 +03:00
Pavlo Yatsukhnenko 0c7b5f4771 Merge branch 'issue.1087' into develop 2017-03-04 19:56:36 +02:00
Pavlo Yatsukhnenko c52077b7b0 Issue #1087
`hStrLen` command
2017-03-04 19:27:31 +02:00
michael-grunder 26aec4dd07 Allow sInterStore to take one arg (as it could be one array)
Addresses #748
2017-01-25 23:12:08 +02:00