TTL
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
TTL key
Returns the remaining time to live of a key that has a timeout, in seconds.
Return value
Returns TTL in seconds, encoded as integer response.
Examples
You can do this as shown below.
$ SET yugakey "Yugabyte"
"OK"
$ EXPIRE yugakey 10
(integer) 1
$ TTL yugakey
(integer) 10