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.

Read more

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.

Read more

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.

Read more

Redis SET Command Explained

In Redis, the SET command sets a key to hold a given string value.

If the key already holds a value, it is overwritten with the new value. Also, any previous time to live associated with the key is discarded (assuming a successful SET operation).

Read more