psetex.3valkey - Man Page

Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn’t exist.

Synopsis

PSETEX key milliseconds value

Description

PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.

Reply

valkey-protocol(7) Simple string reply: OK.

Complexity

O(1)

Acl Categories

@slow @string @write

History

Notes

This command is deprecated (since 2.6.12) and replaced by SET with the PX argument.

Examples

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"

See Also

append(3valkey), decr(3valkey), decrby(3valkey), get(3valkey), getdel(3valkey), getex(3valkey), getrange(3valkey), incr(3valkey), incrby(3valkey), incrbyfloat(3valkey), lcs(3valkey), mget(3valkey), mset(3valkey), msetnx(3valkey), set(3valkey), setrange(3valkey), strlen(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual