Last active
August 29, 2015 13:57
-
-
Save mattsta/9509053 to your computer and use it in GitHub Desktop.
Sample "PGETEX" Redis function returning GET values combined with PTTL. Returns error if non-string key, nil on no key, or a multi-bulk reply of 1.) Value 2.) PTTL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local val = redis.call('get', KEYS[1]) | |
if val then | |
return {val, redis.call('pttl', KEYS[1])} | |
else | |
return false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment