@@ -28,7 +28,7 @@ Locks are used to guarantee exclusive access to some shared resource. In
2828Symfony applications, you can use locks for example to ensure that a command is
2929not 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
3232and then use the :class: `Symfony\\ Component\\ Lock\\ Factory ` class to actually
3333create 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+
123129In case of long-running tasks, it's better to start with a not too long TTL and
124130then use the :method: `Symfony\\ Component\\ Lock\\ LockInterface::refresh ` method
125131to 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
235241collects their responses. If a simple majority of stores have acquired the lock,
236242then 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
252258Instead 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