Redis ZREM – How to delete an element from a sorted set value in redis
3 weeks ago Lalit Bhagtani 0
In this tutorial, we will learn about how to delete one or more specified elements from a sorted set value stored at a key. For this we will use a COMMAND – ZREM in redis-cli.
This command, deletes one or more specified elements from the sorted set stored at the specified key. Specified members that are not present in the sorted set are ignored. Error is returned, if key exist but value stored at the key is not of sorted set datatype. The syntax of redis ZREM command is as follows :-
redis host:post> ZREM <keyname> <element> [ element ]
- (integer) representing number of elements deleted from the sorted set, excluding non existing members. - Error, if key exist and value stored at the key is not a sorted set.
That’s all for how to delete one or more specified elements from a sorted set value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.