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.
Category: NoSQL
2 Ways to Check your Redis Client Version
Here are two quick and easy options to find out what version of the Redis client (redis-cli
) you’re using.
4 Ways to Check your Redis Version
Here are four quick and easy ways to find out what version of Redis you’re using.
Continue readingRedis 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.
Redis MSET Command Explained
In Redis, the MSET
command allows us to set multiple keys at once. It replaces any existing values, just as SET
does.
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).
Redis GET Command Explained
In Redis, the GET
command returns the value of a given key. If the key doesn’t exist, it returns nil
.
An error is returned if the value stored at key
is not a string.
Redis LASTSAVE Command Explained
When using Redis, we can use the LASTSAVE
command to get the Unix time of the last DB save.
More specifically, LASTSAVE
returns the Unix time of the last DB save executed with success.