laravel / ideas

Issues board used for Laravel internals discussions.
939 stars 28 forks source link

Adopt Symfony Lock component #500

Open alexsoft opened 7 years ago

alexsoft commented 7 years ago

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.

barryvdh commented 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?

alexsoft commented 7 years ago

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.

mingalevme commented 6 years ago

May be it will help somebody: https://github.com/mingalevme/illuminate-lock

erlangparasu commented 4 years ago

Try this trait https://symfony.com/doc/3.4/console/lockable_trait.html :)