Back to Yugabyte Db

SETEX

docs/content/stable/yedis/api/setex.md

2026.1.0.0-b25609 B
Original Source

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

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

See also

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