Method: Redis::Connection::Memory#pttl

Defined in:
lib/redis/connection/memory.rb

#pttl(key) ⇒ Object



764
765
766
767
768
769
770
# File 'lib/redis/connection/memory.rb', line 764

def pttl(key)
  if data.expires.include?(key) && (ttl = data.expires[key].to_f - Time.now.to_f) > 0
    ttl * 1000
  else
    exists(key) > 0 ? -1 : -2
  end
end