Method: Redis#ttl

Defined in:
lib/redis.rb

#ttl(key) ⇒ Fixnum

Get the time to live (in seconds) 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



329
330
331
332
333
# File 'lib/redis.rb', line 329

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