Method: Redis#ttl

Defined in:
lib/redis.rb

#ttl(key) ⇒ Fixnum

Get the time to live for a key.

Parameters:

  • key (String)

Returns:

  • (Fixnum)

    remaining time to live in seconds, or -1 if the key does not exist or does not have a timeout



1294
1295
1296
1297
1298
# File 'lib/redis.rb', line 1294

def ttl(key)
  synchronize do
    @client.call [:ttl, key]
  end
end