You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking to implement a reservation system application on top of Redis using RedisJSON and RediSearch, and one of the key features is the ability to:
perform complex searches for specific object types
based on those searches, attempt to mark one of the results as reserved, if reservation is successful, stop, else try another
In order for this to scale horizontally, I want to use something like the SET command with the GET option. So the logic of the reservation would look like this:
return_value = SET reserved 1 GET
if return_value == 1:
# object was reserved by another parallel instance, reservation failed
else:
# object was not already reserved, we reserved it
# do some stuff with the object
# when done
SET reserved 0
However, I'd like this boolean field to be a part of the object's RedisJSON object, and from what I can tell, the JSON.SET command doesn't have a GET option to return the value that was present before the set occurred. Is this possible to add, or is there another way to get this similar style with another JSON command?
A similar command is the JSON.TOGGLE however what I really want is JSON.SET_IF_UNSET where the set only passes if the value was unset before the command started.
Thanks!
The text was updated successfully, but these errors were encountered:
I am looking to implement a reservation system application on top of Redis using RedisJSON and RediSearch, and one of the key features is the ability to:
In order for this to scale horizontally, I want to use something like the SET command with the GET option. So the logic of the reservation would look like this:
However, I'd like this boolean field to be a part of the object's RedisJSON object, and from what I can tell, the
JSON.SET
command doesn't have aGET
option to return the value that was present before the set occurred. Is this possible to add, or is there another way to get this similar style with another JSON command?A similar command is the
JSON.TOGGLE
however what I really want isJSON.SET_IF_UNSET
where the set only passes if the value was unset before the command started.Thanks!
The text was updated successfully, but these errors were encountered: