The Redis PSETEX
command sets a key to hold a given string value, and sets that key to time out after a given number of milliseconds.
Tag: commands
Redis SETEX Command Explained
In Redis, the SETEX
command sets a key to hold a given string value, and sets that key to time out after a given number of seconds.
Redis APPEND Command Explained
In Redis, the APPEND
command appends a given value to the end of the value of a specified key.
If the key doesn’t exist, APPEND
creates the key with the empty string and appends the value to it (so it basically works like the SET
command in this case).
Redis GETDEL Command Explained
The Redis GETDEL
command gets the value of a given key, then deletes that key. It’s similar to the GET
command, except that it deletes the key on success (the GET
command doesn’t delete the key – it only returns its value).
An error is returned if the value stored at key
is not a string.
The GETDEL
command was introduced in Redis 6.2.0.
Redis DEL Command Explained
In Redis, the DEL
command removes one or more keys. If a specified key doesn’t exist, it’s ignored.
Redis LCS Command Explained
In Redis, the LCS
command implements the longest common subsequence algorithm.
The longest common subsequence algorithm finds the longest subsequence common to all sequences in a set of sequences. Note that this is different to the longest common string algorithm (also known as the longest common substring algorithm), which requires that matching characters in the string are contiguous. The longest common subsequence algorithm, on the other hand, doesn’t require matching characters to be contiguous.
The LCS command was introduced in Redis 7.0.0.
Continue readingRedis GETEX Command Explained
The Redis GETEX
command enables us to get the value of a key, then set the key’s expiration. We can also use it to remove any existing expiration associated with the key.
Redis SETNX Command Explained
The Redis SETNX
command sets a key to a given value, but only if the key doesn’t already exist. If the key already holds a value, no operation is performed.
Note: The SET
command can do the same thing, and it’s possible that the SETNX
command may be deprecated at some point. Therefore, it’s probably a good idea to use SET
instead of SETNX
if possible.
Redis MSETNX Command Explained
In Redis, the MSETNX
command allows us to set multiple keys at once, but only if none of them exist.
This allows us to set multiple keys representing different fields of a single logical object in a way that ensures that either all the fields are set, or none are set.
Continue readingRedis MGET Command Explained
In Redis, the MGET
command allows us to get the values of multiple keys at once. The values are returned in an array reply.
If a specified key doesn’t exist, MGET
returns nil
for that key.