Method: Redis::Commands::Keys#pttl
- Defined in:
- lib/redis/commands/keys.rb
#pttl(key) ⇒ Integer
Get the time to live (in milliseconds) for a key.
In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has no associated expire.
Starting with Redis 2.8 the return value in case of error changed:
- The command returns -2 if the key does not exist.
- The command returns -1 if the key exists but has no associated expire.
195 196 197 |
# File 'lib/redis/commands/keys.rb', line 195 def pttl(key) send_command([:pttl, key]) end |