Skip to content

Commit 7446082

Browse files
committed
minor #14294 [lock] Add documentation about fallback logic in lock (jderusse)
This PR was merged into the master branch. Discussion ---------- [lock] Add documentation about fallback logic in lock Fixes #14289 Commits ------- bebcc58 Add documentation about fallback logic in lock
2 parents 184179e + bebcc58 commit 7446082

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

components/lock.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ they can be decorated with the ``RetryTillSaveStore`` class::
9090
$lock = $factory->createLock('notification-flush');
9191
$lock->acquire(true);
9292

93+
When the provided store does not implements the
94+
:class:`Symfony\\Component\\Lock\\BlockingStoreInterface` interface, the
95+
``Lock`` class will try in a loop to acquire the lock in a non-blocking way
96+
until the lock is acquired.
97+
98+
.. deprecated:: 5.2
99+
100+
As of Symfony 5.2, you don't need anymore using the ``RetryTillSaveStore``
101+
class. The ``Lock`` class now provides the default logic to acquire locks in
102+
blocking mode when the store does not implements the ``BlockingStoreInterface``
103+
interface.
104+
93105
Expiring Locks
94106
--------------
95107

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

228+
When the provided store does not implements the
229+
:class:`Symfony\\Component\\Lock\\SharedLockStoreInterface` interface, the
230+
``Lock`` class will fallback to a write lock by calling the ``acquire()``
231+
method.
232+
216233
The Owner of The Lock
217234
---------------------
218235

0 commit comments

Comments
 (0)