In Redis, the ZLEXCOUNT
command returns the number of elements in a sorted set with a value between two given values. It can be used when we force lexicographical ordering by applying the same score to all members of a sorted set.
Tag: commands
Convert a Number to a Date in SQL Server
Trying to convert a number to a date in SQL Server can be tricky and may not always work. It all depends on the number and what exactly it is that we’re trying to do. That said, here are some scenarios where we can convert a number to a date value.
Continue readingRedis ZRANGESTORE Command Explained
In Redis, the ZRANGESTORE
command works just like the ZRANGE
command except that it stores the result in a key.
Basically, it allows us to get all members from a sorted set between a certain range and store them in a new key.
Continue readingRedis ZMSCORE Command Explained
In Redis, the ZMSCORE
command allows us to get the score of one or members in a sorted set.
Redis ZREVRANGEBYLEX 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 ZREVRANGEBYLEX
command. Instead, we should use the ZRANGE
command with the BYLEX
and REV
arguments.
Redis ZSCORE Command Explained
In Redis, the ZSCORE
command returns the score of the specified member of a sorted set.
Redis ZRANGEBYLEX 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 ZRANGEBYLEX
command. Instead, we should use the ZRANGE
command with the BYLEX
argument.
Redis HSTRLEN Command
The Redis HSTRLEN
command allows us to get the length of a value that’s stored in a hash. It returns the string length of the value associated with the specified field at the hash stored in the specified key.
Redis ZUNIONSTORE Command Explained
In Redis, the ZUNIONSTORE
command works in the same way that ZUNION
works, except that it stores the result in a key that we specify.
In other words, it computes the union of the specified sorted sets, then stores the result in the specified key.
Continue readingRedis ZUNION Command Explained
In Redis, the ZUNION
command returns the union of the specified sorted sets.