Created
December 21, 2016 00:24
-
-
Save micha/1e4fd4ee945f24b710f9c441047b0262 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 last_balanced = "lastBalanced" | |
local orphans_key = "orphanAds" | |
local last_balanced_ttl = 60 * 20 | |
for i = 1, #ARGV do | |
local ad_id = ARGV[i] | |
local ad_key = last_balanced .. ":" .. ad_id | |
if redis.call("EXISTS", ad_key) ~= 1 then | |
redis.call("SADD", orphans_key, ad_id) | |
redis.call("SETEX", ad_key, last_balanced_ttl, 1) | |
end | |
end | |
return {ok="OK"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment