193 Commits

Author SHA1 Message Date
Pavlo Yatsukhnenko 5a269ab6d0 Don't allow reconnect on read response 2022-04-03 19:52:18 +03:00
Pavlo Yatsukhnenko 8e58c9d4d6 Remove unused redis_single_line_reply 2022-01-16 16:32:46 +02:00
Pavlo Yatsukhnenko b344649b6f [WIP] Issue #1894
Add geosearch and geosearchstore commands.
2021-12-28 21:17:19 +02:00
Pavlo Yatsukhnenko ee550fb990 Issue #2009 2021-12-13 20:14:26 +02:00
Pavlo Yatsukhnenko 71fbd34a43 Remove unused function redis_sock_copy_auth 2021-12-13 15:47:50 +02:00
Remi Collet fe344e3bbf switch to legacy arginfo for PHP < 8 2021-08-26 09:53:07 +03:00
Remi Collet edac508ef5 use stub/arginfo for RedisSentinel 2021-08-26 09:52:40 +03:00
michael-grunder 4cb4cd0ee2 Separate compression and create utility methods
This commit splits compression and serialization into two distinct parts
and adds some utility functions so the user can compress/uncompress
or pack/unpack data explicily.

See #1939
2021-06-22 10:16:23 -07:00
Pavlo Yatsukhnenko b0b9dd78ef [WIP] Issue #1894
Add GET option to SET command
2021-04-10 21:26:29 +03:00
Pavlo Yatsukhnenko 5d50fef961 [WIP] Issue #1894
Add Redis::zdiff and Redis::zdiffstore commands
2021-03-06 20:15:36 +02:00
Michael Grunder e61ee1da45 Normalize Redis callback prototypes and stop typecasting. (#1935) 2021-02-25 10:03:53 -08:00
Pavlo Yatsukhnenko a534a2c36b [WIP] Issue #1894
Add Redis::zMscore command.
2021-01-17 20:44:04 +02:00
Michael Grunder 950e8de807 Issue.1847 cluster segfault (#1850)
Fix for #1847 when dealing with NULL multi bulk replies in RedisCluster.

Adds `Redis::OPT_NULL_MULTIBULK_AS_NULL` setting to have PhpRedis
treat NULL multi bulk replies as `NULL` instead of `[]`.

Co-authored-by: Alex Offshore <offshore@aopdg.ru>
2020-09-28 11:07:46 -07:00
Michael Grunder a311cc4ec3 Support for Redis 6 ACLs (#1791)
Add support for Redis 6 ACLs in the `Redis`, `RedisCluster`, and `RedisArray` classes.

On a related note, it adds a mechanism for users to customize how we generate persistent connection IDs such that they can be grouped in different ways depending on the specific use case required (e.g. it would allow connections to be grouped by username, or by user-defined persistent_id, or both).
2020-06-24 17:00:01 -07:00
Pavlo Yatsukhnenko b067129678 Issue #1600
Ssl context options in Redis::connect
2020-06-02 17:38:12 +03:00
Pavlo Yatsukhnenko 2bae801050 Issue #1664
In PR #1602 we decided to use unsigned short for storing RedisSock->port
but in previous release I reverted that change. In this PR I changed
signatire of redis_sock_create to prevent unneccecary convertion of types.
2019-11-04 17:21:55 -08:00
Remi Collet b4eb158a00 ulong => zend_ulong for 7.4 2019-07-18 10:37:02 +02:00
Remi Collet 943802272a cleanup TSRMLS_* usage 2019-07-09 15:26:44 +02:00
Pavlo Yatsukhnenko ac9dca0a92 Fix xInfo ro RedisCluster 2019-06-12 13:50:50 +03:00
Pavlo Yatsukhnenko 4852a5106a xInfo response format 2019-06-12 12:20:38 +03:00
michael-grunder 5cb30fb2a6 Adds OPT_REPLY_LITERAL for rawCommand and EVAL
Adds an option to process the actual strings in simple string replies as
opposed to translating them to `true`.  This only applies to
`rawCommand` and `eval` because as far as I know know vanilla Redis
command attaches any information besides `OK` to simple string replies.

Addresses #1550
2019-05-13 09:38:18 -07: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
Pavlo Yatsukhnenko c5994f2a42 RedisCluster auth 2019-01-17 23:05:52 +02:00
Pavlo Yatsukhnenko c0793e8be4 Remove unused parameter lazy_connect from redis_sock_create 2018-11-21 13:39:50 +02: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
Michael Grunder 2c9e057236 Streams (#1413)
Streams API
2018-09-29 11:59:01 -07:00
Pavlo Yatsukhnenko 1d99787375 Change connect/reconnect logic
Persistant connections can be closed via close method.
Connection marked as failed only after reconnection attempts.
2018-08-22 09:02:31 +03: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 7c140714e3 Remove redis_get_exception_base 2017-08-01 18:07:33 +03:00
Pavlo Yatsukhnenko be599147ad runtime exteption 2017-07-25 16:03:02 +03:00
Pavlo Yatsukhnenko ea15ce24cd Remove redis_send_discard duplication 2017-07-13 00:13:19 +03:00
michael-grunder 6a74b959b3 Remove integer_length function 2017-04-28 16:02:04 -07:00
michael-grunder f2d1ccf7c6 Actual removal of redis_cmd_format_static function 2017-04-28 15:57:59 -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 5d35acd246 Remove redis_cmd_append_str and redis_cmd_append_int 2017-04-28 08:23:13 -07:00
michael-grunder 0970ddef03 Remove redis_cmd_format_header command completely 2017-04-28 08:21:00 -07:00
michael-grunder f880655faa Removes legacy function redis_cmd_format() 2017-04-27 22:35:46 -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 9aa3dbfc3d Allow MIGRATE to accept multiple keys 2017-04-22 21:45:08 -07:00
Pavlo Yatsukhnenko c8079eec83 Remove REDIS_DOUBLE_TO_STRING macros 2017-04-21 20:32:31 +03:00
Pavlo Yatsukhnenko b56dc49eec Processing read_timeout parameter + update docs 2017-04-11 15:22:46 +03:00
Pavlo Yatsukhnenko e7ad31e515 Remove unused force_connect parameter from redis_sock_server_open function. 2017-03-29 23:33:53 +03:00
Pavlo Yatsukhnenko 88d870e0d9 refactoring
redis_sock_get and redis_array_get return pointer to RedisSock/RedisArray
structure instead of assign by pointer pointer
2017-02-10 23:30:39 +02:00
Remi Collet 37c754a44a change redis_sock_read_scan_reply to use zend_long 2016-12-21 09:48:39 +01:00
Remi Collet 1435d4540a change redis_serialize to accept strlen_t 2016-12-21 09:28:34 +01:00
Remi Collet c9825cc8c8 fix #1074 change redis_key_prefix to accept strlen_t 2016-12-21 09:13:36 +01:00
Pavlo Yatsukhnenko 70c4d9bac2 Fix broken REDIS_DOUBLE_TO_STRING implementation 2016-12-17 10:43:07 +02:00
Pavlo Yatsukhnenko a23e36f208 zval_get_string
Added gc attribute to zend_string (for zend_string_release).
Added function zval_get_string and replace convert_to_string with it.
2016-12-02 16:04:59 +02:00