This package is a Redis Lua command, to be used with redis-require.
Install it with npm install redis-getcmpset
.
Time complexity: O(1)
Sets key
to newValue
if the current value equals oldValue
.
Returns the value originally stored at key
. If the set succeeded, the return value will be oldValue
.
Returns an error when key exists but does not hold a string value.
Bulk string reply: the value that was stored at key
.