Open alexsoft opened 7 years ago
Currently the Mutex contract uses the Cache to be flexible. Would you implement a Mutex using the Lock component? Or implement the LockInterface with the Laravel cache/mutex?
Benefit now is that you can use any cache back-end, where the Lock component needs configuration for the different drivers (file/redis/memcached), although most can get their information from the cache drivers.
What would the practical benefit be? More reliable?
Currently Mutex contract can only be used in Scheduler. But Lock component as separate component can be used in any scenarios.
But talking specifically about scheduling - I see the benefit. Probably, there is no need to use Lock component in this scenario.
May be it will help somebody: https://github.com/mingalevme/illuminate-lock
Try this trait https://symfony.com/doc/3.4/console/lockable_trait.html :)
Couple of days ago Symfony Lock component was announced. I think it will be great idea to adopt in Laravel framework (+ maybe adding some extra features). And as first usage in laravel framework lock component can be used in withoutOverlapping method in scheduler.
I'd love to do my best and code this feature and contribute it to Laravel.