---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by developer.
--- DateTime: 2022/6/21 14:26
---

local val = redis.call('incr', KEYS[1])
local ttl = redis.call('ttl', KEYS[1])

--获取ARGV内的参数并打印
local expire = ARGV[1]
local times = ARGV[2]

if val == 1 then
    redis.call('expire', KEYS[1], tonumber(expire))
else
    if ttl == -1 then
        redis.call('expire', KEYS[1], tonumber(expire))
    end
end

if val > tonumber(times) then
    return false
end
return true