English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis PEXPIRE Command

Redis Key (key)

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.

Syntax

Basic Syntax of redis PEXPIRE Command

PEXPIRE key milliseconds

Available Version

>=  2.6.0

Return value

Setting successful, returns 1

Key does not exist or setting failed, returns 0

Online Examples

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>

Redis Key (key)