SETEX

This page documents the preview (v2.21) version. Preview includes features under active development and is for development and testing only. For production, use the stable (v2024.1) version.

Synopsis

SETEX key ttl_in_sec string_value

This command sets the value of key to be string_value, and sets the key to expire in ttl_in_sec seconds.

Return value

Returns status string.

Examples

$ SETEX yugakey 10 "Yugabyte"
"OK"
$ GET yugakey
"Yugabyte"
$ TTL yugakey
(integer) 10

See also

append, set, psetex, get, getrange, getset, incr, incrby, setrange, strlen