symfony-docs
symfony-docs copied to clipboard
LockableTrait Documentation Lacks Clarity on Multi-Server Limitations
Description
The documentation for LockableTrait does not clearly mention its limitations regarding available locking backends and its unsuitability for multi-server environments. This can lead to developers (like me) unknowingly using it in scenarios where it won't work as expected, potentially causing issues with concurrent execution.
The documentation should explicitly state that LockableTrait is primarily designed for single-server (or shared filesystem) scenarios.
See also https://github.com/symfony/symfony/issues/35535
What do you think?
Example
However, it's important to note that LockableTrait has certain limitations:
• Limited to single-server environments: LockableTrait relies on internal lock storage that is not shared across servers. This means it is not suitable for distributed locking needed in multi-server setups. • Limited customization: While LockableTrait simplifies locking for basic scenarios, it restricts customization options. It uses internally created stores and factories, preventing the use of custom lock factories or integration with external lock stores like Redis.
For multi-server environments or scenarios requiring more control and customization, we recommend using the LockFactory component directly. Refer to the Lock component documentation for the guidance.