New in Symfony 6.1: Configurable Semaphores
In Symfony 5.2 we introduced a Semaphore component as an alternative to the
existing Lock component. According to the Wikipedia definition, a semaphore
is a variable or abstract data type used to control access to a common resource
by multiple processes in a concurrent system such as a multitasking operating system.
Broadly speaking, a semaphore allows N process to access a resource, and a lock
is a semaphore where N = 1.
In Symfony 6.1 we’re improving Semaphore integration in Symfony applications
thanks to the new framework.semaphore option. First, you can pass a string
with the DSN of the store used by the semaphore:
If your application uses multiple semaphores, configure each of them separately
using the same configuration option:
That’s all! Symfony will create the configured semaphore(s) and will make them
available to your application.