local current_time = redis.call('TIME') local trim_time = tonumber(current_time[1]) - ARGV[2] redis.call('ZREMRANGEBYSCORE', ARGV[1], 0, trim_time) local request_count = redis.call('ZCARD', ARGV[1]) return request_count