Download the PHP package pyaesoneaung/atomic-locks-middleware without Composer
On this page you can find all versions of the php package pyaesoneaung/atomic-locks-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pyaesoneaung/atomic-locks-middleware
More information about pyaesoneaung/atomic-locks-middleware
Files in pyaesoneaung/atomic-locks-middleware
Package atomic-locks-middleware
Short Description A package designed to ensure that only one request is processed at a time.
License MIT
Homepage https://github.com/pyaesoneaung/atomic-locks-middleware
Informations about the package atomic-locks-middleware
Atomic Locks Middleware
A package designed to ensure that only one request is processed at a time.
Installation
Usage
By default, the atomic-locks-middleware uses $request->user()?->id ?: $request->ip()
within atomic locks.
If you prefer to implement IP-based locking, you can use atomic-locks-middleware:ip
.
However, you have the flexibility to define atomic-locks-middleware:{anything}
to customize the locking mechanism according to your preferences.
You can also pass additional parameters to the middleware for more customization. The available parameters are:
{anything} (string)
: Your custom locking mechanism.{lockDuration} (int)
: Duration for which the lock will be held.{canBlock} (bool)
: Whether the request can wait for the lock or not.{blockDuration} (int)
: If waiting is allowed, the maximum duration to wait for the lock.
If no additional parameters are provided, the default values from the config file will be used.
How Does It Work?
The Atomic Locks Middleware uses Laravel Atomic Locks in the background. It initiates a lock at the beginning of the middleware's execution and releases the lock once the response is dispatched to the browser.
Publish Configuration
Publish the configuration for customization
Testing
All versions of atomic-locks-middleware with dependencies
spatie/laravel-package-tools Version ^1.0
illuminate/contracts Version ^9.0|^10.0|^11.0