Redis PEXPIRE Command
The Redis PEXPIRE command works similarly to the EXPIRE command, but it sets the time-to-live of a key in milliseconds, rather than in seconds as the EXPIRE command does.
Syntax
The basic syntax of the Redis PEXPIRE command is as follows:
PEXPIRE key milliseconds
Available Versions
>= 2.6.0
Return Value
Returns 1 if set successfully.
Returns 0 if the key does not exist or the setting fails.
Example
First, create a key and assign a value:
redis> SET mykey "Hello" "OK" redis> PEXPIRE mykey 1500 (integer) 1 redis> TTL mykey (integer) 1 redis> PTTL mykey (integer) 1498 redis>
Other Extensions
Redis Keys