Download the PHP package ivanomatteo/laravel-db-mutex without Composer
On this page you can find all versions of the php package ivanomatteo/laravel-db-mutex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ivanomatteo/laravel-db-mutex
More information about ivanomatteo/laravel-db-mutex
Files in ivanomatteo/laravel-db-mutex
Package laravel-db-mutex
Short Description Your Package Description here
License MIT
Informations about the package laravel-db-mutex
laravel-db-mutex
This library implements a mutex mechanism, using a polymorphic "one to many" relationship.
When calling usingDbMutex(), if not alredy exists, a row matching the current model type, id and the specified "name" field (the default name is "default"), will be added in the db_mutexes table.
On that row will be applied a "lock for update" (the db engine in use must support it), eusuring the mutual exclusion.
In this way you can avoid to put the lock on the table containing your data (possible bottle neck), preserving the read/write capability for all request that do not need a mutual exclusion.
Install
Usage
Write a few lines about the usage of this package.
Warning
When reading the model with the "dbmutex" relation information, it's possible that you have to wait for the lock became avaible on that rows.
It's recommended to load it, only if that one is necessary, for example if you need to use the optimistic lock mechanism with the counter value.
For the same reason, it's also recommended to load the minimum number of dbmutex related rows.
Testing
Run the tests with:
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.