local key = KEYS local lmt = tonumber(ARGV) local ttl = tonumber(ARGV) local now = tonumber(ARGV)

if lmt <= redis.call(“LLEN”, key) and now - redis.call(“LINDEX”, key, -1) < ttl then

return 1

end

redis.call(“LPUSH”, key, now) redis.call(“LTRIM”, key, 0, lmt - 1) redis.call(“EXPIRE”, key, ttl)

return 0