Skip to content

Commit 01dc357

Browse files
committed
Rename quorum into strategy
1 parent d4326c0 commit 01dc357

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

components/lock.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Locks are used to guarantee exclusive access to some shared resource. In
2828
Symfony applications, you can use locks for example to ensure that a command is
2929
not executed more than once at the same time (on the same or different servers).
3030

31-
In order to manage the state of locks, you first need to create a ``Store``
31+
In order to manage the state of locks, a ``Store`` needs to be created first
3232
and then use the :class:`Symfony\\Component\\Lock\\Factory` class to actually
3333
create the lock for some resource::
3434

@@ -120,6 +120,12 @@ method, the resource will stay locked until the timeout::
120120
To avoid letting the lock in a locking state, it's recommended to wrap the
121121
job in a try/catch/finally block to always try to release the expiring lock.
122122

123+
.. tip::
124+
125+
If you forget to release the lock, it will automaticaly be done on instance
126+
destruction, but it's recommended to release it as soon as the lock is no
127+
longer required.
128+
123129
In case of long-running tasks, it's better to start with a not too long TTL and
124130
then use the :method:`Symfony\\Component\\Lock\\LockInterface::refresh` method
125131
to reset the TTL to its original value::
@@ -235,7 +241,7 @@ is being acquired, it forwards the call to all the managed stores, and it
235241
collects their responses. If a simple majority of stores have acquired the lock,
236242
then the lock is considered as acquired; otherwise as not acquired::
237243

238-
use Symfony\Component\Lock\Quorum\ConsensusStrategy;
244+
use Symfony\Component\Lock\Strategy\ConsensusStrategy;
239245
use Symfony\Component\Lock\Store\CombinedStore;
240246
use Symfony\Component\Lock\Store\RedisStore;
241247

@@ -251,7 +257,7 @@ then the lock is considered as acquired; otherwise as not acquired::
251257

252258
Instead of the simple majority strategy (``ConsensusStrategy``) an
253259
``UnanimousStrategy`` can be used to require the lock to be acquired in all
254-
he stores.
260+
the stores.
255261

256262
.. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science)
257263
.. _Packagist: https://packagist.org/packages/symfony/lock

0 commit comments

Comments
 (0)