mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Implement VADD command
This is for Redis 8.0's vector sets.
The command itself can be quite complex with all of the various options but
pretty simple using all defaults.
```php
$redis->vadd('myvec', [3.14, 2.17], 'myelement');
```
The implementation takes a default argument `$options` which can be an array in
order to specify the myriad of other knobs users can send. We just do a bit of
validation on inputs (e.g. certain numeric options must be positive) and make
sure the command is constructed in a valid way (e.g. REDUCE <dim> must come
before the floating point values).
By default we deliver `FP32` blobs but allow the user to send `VALUES` in the
options array which will cause PhpRedis to send N individual values. Sending
values is slower but might be nice for debugging (e.g. watching monitor)
See #2543
This commit is contained in:
committed by
Michael Grunder
parent
9cae7815da
commit
286fa63064
@@ -1053,6 +1053,11 @@ class RedisCluster {
|
||||
*/
|
||||
public function watch(string $key, string ...$other_keys): RedisCluster|bool;
|
||||
|
||||
/**
|
||||
* @see Redis::vadd
|
||||
*/
|
||||
public function vadd(string $key, array $values, mixed $element, array|null $options = null): RedisCluster|int|false;
|
||||
|
||||
/**
|
||||
* @see Redis::xack
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user