-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zAdd GT option seems to be ignored #2319
Comments
Reproducible on different OS, Redis, PHP and phpredis versions too. |
The This works for me: <?php
$r = new Redis;
$r->connect('localhost', 6379);
$r->del('zset');
// Adds member
var_dump($r->zAdd('zset', ['GT'], 4, 'bar'));
// Doesn't update
var_dump($r->zAdd('zset', ['GT'], 2, 'bar'));
var_dump($r->zRange('zset', 0, -1, true)); Edit:
The return value confused me at first too, so I looked it up. Redis will return
Example: <?php
$r = new Redis;
$r->connect('localhost', 6379);
$r->del('zset');
var_dump($r->zAdd('zset', 1, 'bar'));
// Update, returns 0
var_dump($r->zAdd('zset', ['GT'], 3, 'bar'));
// Update, returns 1
var_dump($r->zAdd('zset', ['GT', 'CH'], 7, 'bar')); |
@michael-grunder Do we support |
Yes. |
@taylorotwell: If you don't want to wait for a release, or worse compile phpredis from source, you can use Relay, which is identical to PhpRedis and it's got a Laravel integration: https://github.com/cachewerk/relay/tree/main/src/Laravel |
next release time ? |
unknown |
@taylorotwell: You can use $redis->zadd('example-key', 100, 'example-member');
$redis->rawCommand('ZADD', 'example-key', 'GT', 1, 'example-member'); |
Expected behaviour
When attempting to update the score of a member with the
GT
flag, the score should not be updated unless the score is greater than the existing score.Actual behaviour
The score is updated when it should not be, even though
0
is returned byphpredis
indicating no records should have been updated.I'm seeing this behaviour on
Steps to reproduce, backtrace or example script
I've checked
develop
branchThe text was updated successfully, but these errors were encountered: