Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Psetex command

Redis Psetex command

Redis string

The Redis Psetex command sets the time to live of a key in milliseconds.

Syntax

The basic syntax of the redis Psetex command is as follows:



redis 127.0.0.1:6379> PSETEX key1 EXPIRY_IN_MILLISECONDS value1 

Available Version

= 2.6.0

Return Value

Returns OK on success.

Example



redis 127.0.0.1:6379> PSETEX mykey 1000 "Hello"

OK

redis 127.0.0.1:6379> PTTL mykey

999

redis 127.0.0.1:6379> GET mykey

1) "Hello"

Redis string