Download the PHP package rtckit/react-redlock without Composer
On this page you can find all versions of the php package rtckit/react-redlock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package react-redlock
Distributed locks with Redis and ReactPHP
Asynchronous Redlock algorithm implementation for PHP
Quickstart
Once installed, you can incorporate Redlock in your projects by instantiating its Custodian; this entity is responsible for lock orchestration and it requires access to a Redis client object instance, e.g.
Acquiring locks
For use cases where a binary outcome is desirable, the acquire()
method works best, e.g.:
Spinlocks
The spin()
method is designed for situations where a process should keep trying acquiring a lock, e.g.
Lastly, the provided examples are a good starting point.
Requirements
Redlock is compatible with PHP 7.2+ and requires the clue/reactphp-redis library.
Installation
You can add the library as project dependency using Composer:
If you only need the library during development, for instance when used in your test suite, then you should add it as a development-only dependency:
Tests
To run the test suite, clone this repository and then install dependencies via Composer:
Then, go to the project root and run:
Static Analysis
In order to ensure high code quality, Redlock uses PHPStan and Psalm:
License
MIT, see LICENSE file.
Acknowledgments
- antirez - Original blog post
- ReactPHP Project
- clue/reactphp-redis - Async Redis client implementation
Contributing
Bug reports (and small patches) can be submitted via the issue tracker. Forking the repository and submitting a Pull Request is preferred for substantial patches.