Conditionally add `[[nodiscard]]` (c23) or
`__attribute__((warn_unused_result))` when the compiler supports it.
This commit initially just adds iit to `cluster_map_keyspace` but we can
go throughour API adding it where appropriate.
All of these commands have the same form `<cmd> key`. `VINFO` is a bit
of an outlier however that uses simple strings as opposed to bulk
strings for the key names, meaning we had to create a custom handler.
See #2543
* Rework HMGET and implement HGETEX
Instead of using a bespoke NULL terminated `zval**` array for the
context array we can use a `HashTable`. This might be a tiny bit more
expensive but Zend hashtables are quite efficient and this should also
be less error prone.
* Rework our `HashTable` context array to store keys
Instead of sending an array of values we can instead add the fields as
keys to our context array. That way when we combine the keys with the
Redis provided values we can do it in-place and then just give the
HashTable to the user to then do with what they want.
* Implement HGETDEL command.
* Fix edge cases to abide by legacy behavior.
Previously we coerced integer strings into integer keys when zipping
`HMGET` responses. This commit adds logic so we continue to do this and
do not change semantics.
* Implement `HGETDEL` and `HGETEX` for `RedisCluster`.
This commit implements the new commands and reworks the `HMGET` reply
handler to use the new context `HashTable`.
* Fix an edge case where we get zero multiblk elements
* Tests for `HGETEX` and `HGETDEL`
* Minor logic improvement
We don't need to check if `c->reply_len > 0` in the last else block
since we have already determined it must be.
* Implement `HSETEX` for `Redis` and `RedisCluster`
* Use `zval_get_tmp_string` ro populating non-long keys
We also need to update the `RedisCluster` logic to handle very large
curosr values, in addition to handling them for the `Redis` and
`RedisArray` classes.
See #2454, #2458
* Use our `redis_cmd_append_sstr_key_*` and `redis_cmd_append_sstr_zval`
wrappers, which handle key prefixing and serialization transparently.
* Rework ZADD so it can handle the bulk double response from the `INCR`
options.
* Implement `ZDIFF`, `ZINTER`, `ZUNION`, `ZMSCORE`, and
`ZRANDMEMBER` for `RedisCluster`.
* Refactor `ZUNIONSTORE` command and switch to using our centralized
zset option parsing handler.
See #1894
* Create inline wrappers of the low-level php_stream_* functions that
also keep track of the number of bytes written/read.
* Change the logic to aggregate network traffic until the user
explicitly "resets" it. I think this will be a more common use-case
(running many commands and then seeing overall network IO).
See #2106
* Add ZRANGESTORE command.
* Add Redis 6.2's `REV`, `BYLEX`, and `BYSCORE` to ZRANGE options.
* Refactor several ZRANGE family commands into a single reply and
options handler, using PHP's new argument parsing macros.
* Extend our tests to use the new ZRANGE options.
See #1894
Implement the new Redis 7.0.0 commands to pop multiple elements from one
or more lists/zsets.
Additionally, remove INTERNAL_FUNCTION_PARAMETERS from the
redis_sock_read_multibulk_reply_zval helper function as it wasn't
actually being used.
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>
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).
Various improvements and fixes to cluster slot caching.
* Improves slot caching so any unique set of seeds all hash to the same key
* Fix a couple of memory leaks.
* Fixes a segfault when executing a multiple key command such as `MGET` or `MSET` while the cluster is resharding.
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
RedisCluster currently has a high construction overhead because
every request has to issue a CLUSTER SLOTS command to map the
keyspace. The issue is especially evident when a request only
does a few commands.
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
* Reset the socket after a timeout to make sure no wrong data is received
* Remove the lazy_connect completely
* Missing TSRMLS_CC
* Remove redundant check if the stream exists
* Add the redis_sock_server_open to the CLUSTER_SEND_PAYLOAD macro