129 Commits

Author SHA1 Message Date
michael-grunder
c3a7163108 Rework CLUSTER_RESET_MULTI to be a static function 2025-08-21 08:53:51 -07:00
michael-grunder
b004051499 Rewowrk CLUSTER_FREE_QUEUE as a static function 2025-08-21 08:53:51 -07:00
michael-grunder
fae89fa992 Remove dead macro CLUSTER_BUILD_CMD 2025-08-21 08:53:51 -07:00
michael-grunder
f880e1f727 Make CLUSTER_ENQUEUE_RESPONSE a static function 2025-08-21 08:53:51 -07:00
michael-grunder
b90e27f285 Rework CLUSTER_PROCESS_KW_CMD to be a small wrapper macro + function
This commit is similar to the last one reworking processing keyword
commands to work to use a function instead of a big multiline macro.
2025-08-21 08:53:51 -07:00
michael-grunder
1db3908914 Rework CLUSTER_PROCESS_CMD to use an underlying function
In theory this should reduce PhpRedis' code size and likely doesn't
affect performance in a measurable way.
2025-08-21 08:53:51 -07:00
Pavlo Yatsukhnenko
9036ffca6a Add getWithMeta method 2025-02-25 16:27:10 +02:00
Remi Collet
a7e5ea643a fix closing condition 2022-07-18 13:46:11 +02:00
Remi Collet
3675f442e4 mark auth param as sensitive for PHP 8.2
refactor MINIT (split in each class sources file)
use @generate-class-entries in stub files
add RedisException and RedisClusterException in stub files
2022-07-18 13:45:45 +02:00
Pavlo Yatsukhnenko
eca6278f6a [WIP] Use stub/arginfo for RedisCluster 2021-08-26 09:55:38 +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
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
bbcf32a37f Remove unused declarations 2020-03-21 17:04:15 +02:00
Pavlo Yatsukhnenko
a42cf189a7 Remove duplicate definitions 2020-03-19 23:00:25 +02:00
Pavlo Yatsukhnenko
d5dadaf635 Add PHPREDIS_GET_OBJECT and PHPREDIS_ZVAL_GET_OBJECT macros 2020-03-09 13:36:27 +02:00
Remi Collet
943802272a cleanup TSRMLS_* usage 2019-07-09 15:26:44 +02:00
michael-grunder
eb81b9153c Merge branch 'issue-1509' into issue.1448-require_php7 2019-02-23 17:41:19 -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
Marin Bezhanov
46f035615e Add ZPOPMAX and ZPOPMIN support 2019-02-17 13:05:58 +02: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
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
2c9e057236 Streams (#1413)
Streams API
2018-09-29 11:59:01 -07: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
Pavlo Yatsukhnenko
658ee37410 ZEND_HASH_FOREACH_PTR 2017-08-15 13:38:39 +03:00
Pavlo Yatsukhnenko
c52077b7b0 Issue #1087
`hStrLen` command
2017-03-04 19:27:31 +02:00
Pavlo Yatsukhnenko
8a4eeecaf3 WIP: php7 compatibility 2016-11-10 21:39:34 +02:00
Pavlo Yatsukhnenko
88658b5e9b WIP: php7 compatibility
Wrap create_cluster_context
2016-10-25 22:03:44 +03:00
Pavlo Yatsukhnenko
75183064b5 WIP: php7 compatibility
Wrap zend_register_internal_class_ex calls + redis-cluster GET_CONTEXT
2016-10-11 22:50:30 +03:00
Pavlo Yatsukhnenko
46c2de1b8a WIP: php7 compatibility
Redefine `zend_hash_get_current_data` macro as static inline function +
add `zend_hash_get_current_data_ptr` function
2016-09-13 17:15:52 +03:00
michael-grunder
3a33700c28 Cluster geo commands and a generic so cluster and redis tests both work 2016-06-08 12:28:57 -07:00
michael-grunder
3491b188e0 Added a new method sAddArray to both Redis and RedisCluster
Presently, the sAdd command is variadic, meaning that it takes a key
and then 1 to N additional arguments for the members being added.  We
need to keep this functionality to avoid breaking existing code,
but there are good performance and other reasons to have an sAdd
command which takes a key followed by an array of members, which is
what the sAddArray method implements.
2015-05-08 14:12:34 -07:00
michael-grunder
91b5a37b88 Implement rawCommand() properly, as it's not the COMMAND command in Redis. 2015-05-06 20:29:54 -07:00
michael-grunder
4b974d2873 Use win32 function prototypes for lib functions 2015-05-05 15:26:07 -07:00
michael-grunder
7e1f082054 Implement getMode for RedisCluster 2015-05-05 15:12:41 -07:00
michael-grunder
687a5ad64a Implements the getMode() command
Rename command to rawCommand() as it's named in phpredis proper
This introspection function will inform the caller what mode phpredis
is in (atomic, pipeline, multi)

Conflicts:
	php_redis.h
2015-05-05 15:12:41 -07:00
michael-grunder
a271c4852c Initial commit incorporating a "readonly" flag.
We may want to configure phpredis such that it will attempt to fall back
to a given master's slave, if the master were to go down (and the command
is read only).
2015-05-05 15:05:30 -07:00
michael-grunder
5ed61ea305 Added getlasterror()/clearlasterror() routines, and a
"last redirection" introspection method.
2015-05-05 15:05:29 -07:00
michael-grunder
01414b1f4f Implement remaining commands
For certain commands that need to be directed at a node
(CONFIG, CLIENT, SCRIPT, etc), the syntax can be complicated
and highly variant.  For this reason, these remaining commands
have been implemented in a generic way, where users will rely
on the error message from Redis to figure out what went wrong.

All of the commands take our standardized "node" argument which
can either take the form of a string key, or Array(host, port).
2015-05-05 15:04:12 -07:00
michael-grunder
03082de7b4 COMMAND command
Implement the new COMMAND command in Redis for both cluster and
non cluster classes.  This command is really more of a debug tool
but should actually be useful for updating the unit tests as we
can now simply detect which commands do and don't exist, etc.
2015-05-05 15:04:12 -07:00
michael-grunder
6594746616 ECHO command
Implemented the ECHO command for cluster, which like other commands
where you send to a specific node, can be done either by sending
"at" a key, or by sending to a host/port
2015-05-05 15:04:12 -07:00
michael-grunder
265837230d ZREMRANGEBYLEX
Implemented ZREMRANGEBYLEX in Redis and RedisCluster, and made the
zlexcount command generic, as it has the same semantics.
2015-05-05 15:04:12 -07:00
michael-grunder
77bcc2b2c4 ZREVRANGEBYLEX
Implemented ZREVRANGEBYLEX for Redis and RedisCluster, and made
command construction a generic that can handle either.
2015-05-05 15:04:12 -07:00
michael-grunder
3714ebb23d PING response
Implemented PING for RedisCluster
2015-05-05 15:04:12 -07:00
michael-grunder
56419cdaa6 RANDOMKEY
Implemented RANDOMKEY command for Redis Cluster
2015-05-05 15:04:11 -07:00
michael-grunder
a85e04b2fe TIME/ROLE
Implemented ROLE and TIME commands in RedisCluster, as well as
updated the TIME command for Redis proper such that we use the
new calling convention.

Updated redis_read_variant_reply to take a context void* so it
conforms with the correct prototype.
2015-05-05 15:04:11 -07:00
michael-grunder
23572bb2e2 LINDEX
Implemented LINDEX command in RedisCluster
2015-05-05 15:03:10 -07:00
michael-grunder
a4b160c4a1 ZLEXCOUNT
Implemented ZLEXCOUNT for both Redis and RedisCluster.

Removed unused variable in INFO response processor
2015-05-05 15:03:10 -07:00
michael-grunder
0c7a1ba6e8 ZRANGEBYLEX
Implemented ZRANGEBYLEX for both Redis and RedisCluster
2015-05-05 15:03:10 -07:00
michael-grunder
59038f4232 INFO command as well as a direct slot tweak
This commit implements the INFO command for RedisCluster, which
behaves like other direct to node commands and can take either
a key or a host and port.

Updated cluster_send_slot function such that on success it sets
the proper reply slot.
2015-05-05 15:03:10 -07:00