mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-27 02:10:52 +08:00
13 lines
367 B
Lua
13 lines
367 B
Lua
local key = KEYS[1];
|
|
local increment = tonumber(ARGV[1]) or 0;
|
|
local ttl = tonumber(ARGV[2]) or 0;
|
|
|
|
if redis.call("EXISTS", key) == 1 then
|
|
redis.call("INCRBY", key, increment);
|
|
local sum = tonumber(redis.call("GET", key)) or 0;
|
|
-- extend the life of this counter by ttl seconds
|
|
redis.call("EXPIRE", key, ttl);
|
|
return sum;
|
|
else
|
|
return nil;
|
|
end
|