TTL

Synopsis

TTL keyReturns 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.

  1. $ SET yugakey "Yugabyte"
  1. "OK"
  1. $ EXPIRE yugakey 10
  1. (integer) 1
  1. $ TTL yugakey
  1. (integer) 10

See also

set, expire, expireat, pttl