local restored = math.min(capacity, tokens + elapsed * refill)
local allowed = restored >= cost
local remaining = allowed and (restored - cost) or restored
redis.call('HSET', key, 'tokens', remaining, 'updated_at', now)
redis.call('EXPIRE', key, ttl)
return { allowed and 1 or 0, remaining, retry_after }Redis guarantees atomic script and Function execution. LimitLine models those semantics; it does not connect to a hosted Redis instance. Redis documentation