English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis PEXPIRE command is similar to the EXPIRE command, but it sets the key's expiration time in milliseconds, unlike the EXPIRE command which sets the key's expiration time in seconds.
Basic Syntax of redis PEXPIRE Command
PEXPIRE key milliseconds
>= 2.6.0
Setting successful, returns 1
Key does not exist or setting failed, returns 0
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>