diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index 02f635f5788..19f30e86d96 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -43,4 +43,24 @@ that adds two convenient methods to lock and release commands:: } } +The LockableTrait will use the ``SemaphoreStore`` if available and will default +to ``FlockStore`` otherwise. You can override this behavior by setting +a ``$lockFactory`` property with your own lock factory:: + + // ... + use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Command\LockableTrait; + use Symfony\Component\Lock\LockFactory; + + class UpdateContentsCommand extends Command + { + use LockableTrait; + + public function __construct(private LockFactory $lockFactory) + { + } + + // ... + } + .. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science)