Skip to content

TTL

TTL key

TTL returns the remaining time to live (in seconds) of a key that has an expiration set.

  • Returns -1 if the key has no expiration.
  • Returns -2 if the key does not exist.
localhost:7379> SET k 43
OK
localhost:7379> TTL k
OK -1
localhost:7379> SET k 43 EX 10
OK
localhost:7379> TTL k
OK 8
localhost:7379> TTL kn
OK -2