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
if redis.call("EXISTS", KEYS[1]) == 1 then -- See if key for quantity exists | |
if redis.call("INCRBY", KEYS[1], ARGV[1]) >= 0 then -- "Increment" the key by -quantity | |
-- and check the new value | |
redis.call("EXPIRE", KEYS[1], ARGV[2]) -- set an expiry time on this booking | |
return true | |
else | |
return false | |
end | |
else | |
return false |