DurationLimiter
class DurationLimiter (View source)
Properties
| int | $decaysAt | The timestamp of the end of the current duration. |
|
| int | $remaining | The number of remaining slots. |
Methods
Create a new duration limiter instance.
Attempt to acquire the lock for the given number of seconds.
Attempt to acquire the lock.
Get the Lua script for acquiring a lock.
Details
void
__construct(Connection $redis, string $name, int $maxLocks, int $decay)
Create a new duration limiter instance.
mixed
block(int $timeout, callable|null $callback = null)
Attempt to acquire the lock for the given number of seconds.
bool
acquire()
Attempt to acquire the lock.
protected string
luaScript()
Get the Lua script for acquiring a lock.
KEYS[1] - The limiter name ARGV[1] - Current time in microseconds ARGV[2] - Current time in seconds ARGV[3] - Duration of the bucket ARGV[4] - Allowed number of tasks
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.