Skip to content

[lock] Add documentation about fallback logic in lock #14294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ they can be decorated with the ``RetryTillSaveStore`` class::
$lock = $factory->createLock('notification-flush');
$lock->acquire(true);

When the provided store does not implements the
:class:`Symfony\\Component\\Lock\\BlockingStoreInterface` interface, the
``Lock`` class will try in a loop to acquire the lock in a non-blocking way
until the lock is acquired.

.. deprecated:: 5.2

As of Symfony 5.2, you don't need anymore using the ``RetryTillSaveStore``
class. The ``Lock`` class now provides the default logic to acquire locks in
blocking mode when the store does not implements the ``BlockingStoreInterface``
interface.

Expiring Locks
--------------

Expand Down Expand Up @@ -213,6 +225,11 @@ possible to **promote** the lock, and change it to write lock, by calling the
In the same way, it's possible to **demote** a write lock, and change it to a
read-only lock by calling the ``acquireRead()`` method.

When the provided store does not implements the
:class:`Symfony\\Component\\Lock\\SharedLockStoreInterface` interface, the
``Lock`` class will fallback to a write lock by calling the ``acquire()``
method.

The Owner of The Lock
---------------------

Expand Down