The Redis PERSIST
command removes any existing timeout on a given key. It returns an integer reply of 1
if the timeout was removed, or 0
if the key doesn’t exist or doesn’t have an associated timeout.
Tag: commands
Redis PTTL Command Explained
In Redis, the PTTL
command returns the remaining time to live of a given key, in milliseconds.
If the key doesn’t have a timeout, an integer reply of -1
is returned. If the key doesn’t exist, -2
is returned.
PTTL
works the same as the TTL
command, except that it returns the result in milliseconds instead of seconds.
Redis TTL Command Explained
In Redis, the TTL
command returns the remaining time to live of a given key, in seconds.
If the key doesn’t have a timeout, an integer reply of -1
is returned. If the key doesn’t exist, -2
is returned.
Redis also has a PTTL
command, which works the same, but returns its result in milliseconds.
Redis PEXPIRETIME Command Explained
The Redis PEXPIRETIME
command returns the absolute Unix timestamp in milliseconds at which the given key will expire. This is the number of milliseconds since 00:00:00 UTC on 1 January 1970 until the expiry time of the key.
This works exactly the same as EXPIRETIME
, but it returns the Unix timestamp in milliseconds instead of seconds.
The PEXPIRETIME
command was introduced in Redis 7.0.0.
Redis EXPIRETIME Command Explained
The Redis EXPIRETIME
command returns the absolute Unix timestamp in seconds at which the given key will expire. This is the number of seconds since 00:00:00 UTC on 1 January 1970 until the expiry time of the key.
The EXPIRETIME
command was introduced in Redis 7.0.0.
Redis EXPIREAT Command Explained
The Redis EXPIREAT
command sets a timeout as a Unix timestamp on a given key. It works the same as the EXPIRE
command, but with an absolute Unix timestamp instead of a time interval in seconds (which EXPIRE
uses).
Redis PEXPIREAT Command Explained
The Redis PEXPIREAT
command sets a timeout as a Unix timestamp on a given key in milliseconds. It works the same as the EXPIREAT
command, except that it sets the timeout in milliseconds instead of seconds.
It’s also similar to the PEXPIRE
command, but with an absolute Unix timestamp instead of a time interval.
Redis PEXPIRE Command Explained
The Redis PEXPIRE
command sets a timeout on a given key in milliseconds. After the timeout has expired, the key will be deleted.
The PEXPIRE
command works exactly the same as the EXPIRE
command, except that it returns the timeout in milliseconds instead of seconds.
Redis EXPIRE Command Explained
The Redis EXPIRE
command sets a timeout on a given key in seconds. After the timeout has expired, the key will be deleted.
Redis also has a PEXPIRE
command that works the same as EXPIRE
, except that it returns the timeout in milliseconds instead of seconds.
A key with a timeout is said to be volatile in Redis terminology.
Continue readingRedis STRLEN Command Explained
In Redis, the STRLEN
command returns the length of the string stored at a given key.