@@ -108,12 +108,10 @@ to handle the rest of the job::
108
108
109
109
use App\Lock\RefreshTaxonomy;
110
110
use Symfony\Component\Lock\Key;
111
- use Symfony\Component\Lock\Lock;
112
111
113
112
$key = new Key('article.'.$article->getId());
114
- $lock = new Lock (
113
+ $lock = $factory->createLockFromKey (
115
114
$key,
116
- $this->store,
117
115
300, // ttl
118
116
false // autoRelease
119
117
);
@@ -124,7 +122,7 @@ to handle the rest of the job::
124
122
.. note ::
125
123
126
124
Don't forget to set the ``autoRelease `` argument to ``false `` in the
127
- ``Lock `` constructor to avoid releasing the lock when the destructor is
125
+ ``Lock `` instantiation to avoid releasing the lock when the destructor is
128
126
called.
129
127
130
128
Not all stores are compatible with serialization and cross-process locking: for
@@ -402,20 +400,20 @@ Locks are created and managed in ``Stores``, which are classes that implement
402
400
403
401
The component includes the following built-in store types:
404
402
405
- ========================================================== ====== ======== ======== =======
406
- Store Scope Blocking Expiring Sharing
407
- ========================================================== ====== ======== ======== =======
408
- :ref: `FlockStore <lock-store-flock >` local yes no yes
409
- :ref: `MemcachedStore <lock-store-memcached >` remote no yes no
410
- :ref: `MongoDbStore <lock-store-mongodb >` remote no yes no
411
- :ref: `PdoStore <lock-store-pdo >` remote no yes no
412
- :ref: `DoctrineDbalStore <lock-store-dbal >` remote no yes no
413
- :ref: `PostgreSqlStore <lock-store-pgsql >` remote yes no yes
414
- :ref: `DoctrineDbalPostgreSqlStore <lock-store-dbal-pgsql >` remote yes no yes
415
- :ref: `RedisStore <lock-store-redis >` remote no yes yes
416
- :ref: `SemaphoreStore <lock-store-semaphore >` local yes no no
417
- :ref: `ZookeeperStore <lock-store-zookeeper >` remote no no no
418
- ========================================================== ====== ======== ======== =======
403
+ ========================================================== ====== ======== ======== ======= =============
404
+ Store Scope Blocking Expiring Sharing Serialization
405
+ ========================================================== ====== ======== ======== ======= =============
406
+ :ref: `FlockStore <lock-store-flock >` local yes no yes no
407
+ :ref: `MemcachedStore <lock-store-memcached >` remote no yes no yes
408
+ :ref: `MongoDbStore <lock-store-mongodb >` remote no yes no yes
409
+ :ref: `PdoStore <lock-store-pdo >` remote no yes no yes
410
+ :ref: `DoctrineDbalStore <lock-store-dbal >` remote no yes no yes
411
+ :ref: `PostgreSqlStore <lock-store-pgsql >` remote yes no yes no
412
+ :ref: `DoctrineDbalPostgreSqlStore <lock-store-dbal-pgsql >` remote yes no yes no
413
+ :ref: `RedisStore <lock-store-redis >` remote no yes yes yes
414
+ :ref: `SemaphoreStore <lock-store-semaphore >` local yes no no no
415
+ :ref: `ZookeeperStore <lock-store-zookeeper >` remote no no no no
416
+ ========================================================== ====== ======== ======== ======= =============
419
417
420
418
.. tip ::
421
419
0 commit comments