I am having an issue when I try to add "NX" to the zadd command on predis. The redis docs say that ZADD should support NX, but no matter how I set up the predis command, I can not get it working. Does anyone have any experience with this issue?
Here are the commands I have tried:
$redis->zadd($key, "NX", 1, $id);
$redis->executeRaw([ 'ZADD', $key, "NX", 1, $id ]);
Here is the error that keeps getting thrown:
ERROR: exception 'Predis\ServerException' with message 'ERR syntax error'
Looking at the redis-cli monitor, I see the command execute when using the ZADD command, but the executeRaw command does nothing.
Any help would be greatly appreciated!
ZADD
'sNX
switch was added only to the recent version of Redis, see here: https://groups.google.com/forum/#!topic/redis-db/4Y6OqK8gEykIn all likelihood you aren't running the recent version - use
INFO
to find out your server's version.