In Redis, the ZCOUNT
command returns the number of elements in a sorted set with a score between two given values.
Tag: commands
Redis ZREVRANK Command Explained
In Redis, the ZREVRANK
command returns the rank of the specified element of a sorted set ordered in descending order (from high to low).
If we want the set to be in ascending order, we can use the ZRANK
command.
Redis ZRANK Command Explained
In Redis, the ZRANK
command returns the rank of the specified element of a sorted set.
The scores are ordered from low to high. If we want them in the opposite order, we can use the ZREVRANK
command.
Redis ZRANDMEMBER Command Explained
In Redis, the ZRANDMEMBER
command enables us to get one or more random elements from a sorted set.
We can specify whether or not to return only distinct elements or to allow duplicates. We can also specify whether or not to include the scores of each element in the result.
Continue readingRedis ZRANGEBYSCORE Replacement
Starting with Redis 6.2.0, the ZRANGE
command added the REV
, BYSCORE
, BYLEX
and LIMIT
options. The addition of the first three options means that the ZRANGE
command can now do what the ZREVRANGE
, ZRANGEBYSCORE
, ZREVRANGEBYSCORE
, ZRANGEBYLEX
and ZREVRANGEBYLEX
commands can do.
As a result, those commands are now deprecated (as of Redis 6.2.0).
Therefore, we should no longer use the ZRANGEBYSCORE
command when we need to return a sorted set by score. Instead, we should use the ZRANGE
command with the BYSCORE
argument.
Redis ZRANGE Command Explained
In Redis, the ZRANGE
command returns the specified range of elements in the sorted set stored at the specified key.
It can perform different types of range queries: by index (rank), by the score, or by lexicographical order.
Continue readingRedis ZADD Command Explained
In Redis, the ZADD
command is used to add one or more members to a sorted set, or to update the score for members that already exist in the sorted set.
It returns the number of elements added to the sorted set, or the number of elements updated if the CH
argument is used.
Redis HINCRBYFLOAT Command
The Redis HINCRBYFLOAT
command increments the field in the hash at the specified key by a floating point number. We specify how much we want the field to increment by when we call the command.
Redis HINCRBY Command
The Redis HINCRBY
command increments the number that’s stored at the specified field in the hash at the specified key. We specify how much we want the field to increment by when we call the command.
Redis HVALS Command
The Redis HVALS
command returns all values in the hash stored at the specified key.