Created
July 3, 2019 14:48
-
-
Save banker/3dbed95c79bab81aef30da0e87063860 to your computer and use it in GitHub Desktop.
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
public static String script = "" + | |
"local key = KEYS[1]" + | |
"local field = ARGV[1]" + | |
"local value = ARGV[2]" + | |
"local op = ARGV[3]" + | |
"local current = redis.call('hget', key, field)" + | |
"if (current == null) then " + | |
" redis.call('hset', key, field, value)" + | |
"elseif op == '>' then" + | |
" if tonumber(value) > tonumber(current) then" + | |
" redis.call('hset', key, field, value)" + | |
" end " + | |
"elseif op == '<' then" + | |
" if tonumber(value) < tonumber(current) then" + | |
" redis.call('hset', key, field, value)" + | |
" end " + | |
"end "; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment