Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
Created August 5, 2015 21:29
Show Gist options
  • Save itamarhaber/217968c5d54066df4743 to your computer and use it in GitHub Desktop.
Save itamarhaber/217968c5d54066df4743 to your computer and use it in GitHub Desktop.
Redis absolute TTL (accuracy +/- 1 second)
-- Returns a key's absolute TTL
local t = tonumber(redis.call('TTL', KEYS[1]))
if t > 0 then
t = t + tonumber(redis.call('TIME')[1])
end
return t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment