API ReferenceKeys
TTL
Get the time-to-live of a key in seconds
Syntax
Redix.TTL(key, callback)Parameters
Prop
Type
Returns
Prop
Type
Example
Redix.TTL('session:abc', function(err, ttl)
if not err then
if ttl == -2 then
print('Key does not exist')
elseif ttl == -1 then
print('Key has no expiration')
else
print('Key expires in ' .. ttl .. ' seconds')
end
end
end)