Redis.ttl

The TTL command returns the remaining time to live in seconds of a key that has an {@link #expire(string, int) EXPIRE} set. This introspection capability allows a Redis client to check how many seconds a given key will continue to be part of the dataset. @param key @return Integer reply, returns the remaining time to live in seconds of a key that has an EXPIRE. In Redis 2.6 or older, if the Key does not exists or does not have an associated expire, -1 is returned. In Redis 2.8 or newer, if the Key does not have an associated expire, -1 is returned or if the Key does not exists, -2 is returned.

  1. Long ttl(string key)
    class Redis
    Long
    ttl
    (
    string key
    )
  2. alias ttl = BinaryRedis.ttl

Meta