Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn’t exist.
PSETEX
key
milliseconds value
PSETEX
works exactly like SETEX
with the
sole difference that the expire time is specified in milliseconds
instead of seconds.
Simple string
reply: OK
.
O(1)
@slow @string @write
127.0.0.1:6379> PSETEX mykey 1000 "Hello"
OK
127.0.0.1:6379> PTTL mykey
(integer) 990
127.0.0.1:6379> GET mykey
"Hello"
SET
with the
PX
argument.APPEND, DECR, DECRBY, GET, GETDEL, GETEX, GETRANGE, INCR, INCRBY, INCRBYFLOAT, LCS, MGET, MSET, MSETNX, SET, SETRANGE, STRLEN.