@@ -216,7 +216,6 @@ Store Scope Blocking Expiring
216216============================================ ====== ======== ========
217217:ref: `FlockStore <lock-store-flock >` local yes no
218218:ref: `MemcachedStore <lock-store-memcached >` remote no yes
219- :ref: `MongoDbStore <lock-store-mongodb >` remote no yes
220219:ref: `PdoStore <lock-store-pdo >` remote no yes
221220:ref: `RedisStore <lock-store-redis >` remote no yes
222221:ref: `SemaphoreStore <lock-store-semaphore >` local yes no
@@ -263,39 +262,6 @@ support blocking, and expects a TTL to avoid stalled locks::
263262
264263 Memcached does not support TTL lower than 1 second.
265264
266- .. _lock-store-mongodb :
267-
268- MongoDbStore
269- ~~~~~~~~~~~~
270-
271- .. versionadded :: 4.3
272-
273- The ``MongoDbStore `` was introduced in Symfony 4.3.
274-
275- The MongoDbStore saves locks on a MongoDB server, it requires a
276- ``\MongoDB\Client `` connection from `mongodb/mongodb `_. This store does not
277- support blocking and expects a TTL to avoid stalled locks::
278-
279- use Symfony\Component\Lock\Store\MongoDbStore;
280-
281- $mongoClient = new \MongoDB\Client('mongo://localhost/');
282-
283- $options = [
284- 'database' => 'my-app',
285- ];
286-
287- $store = new MongoDbStore($mongoClient, $options);
288-
289- The ``MongoDbStore `` takes the following ``$options ``:
290-
291- ============ ========= ========================================================================
292- Option Default Description
293- ============ ========= ========================================================================
294- database The name of the database [Mandatory]
295- collection ``lock `` The name of the collection
296- gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
297- ============ ========= ========================================================================
298-
299265.. _lock-store-pdo :
300266
301267PdoStore
@@ -432,7 +398,7 @@ Remote Stores
432398~~~~~~~~~~~~~
433399
434400Remote stores (:ref: `MemcachedStore <lock-store-memcached >`,
435- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >`,
401+ :ref: `PdoStore <lock-store-pdo >`,
436402:ref: `RedisStore <lock-store-redis >` and
437403:ref: `ZookeeperStore <lock-store-zookeeper >`) use a unique token to recognize
438404the true owner of the lock. This token is stored in the
@@ -457,7 +423,7 @@ Expiring Stores
457423~~~~~~~~~~~~~~~
458424
459425Expiring stores (:ref: `MemcachedStore <lock-store-memcached >`,
460- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >` and
426+ :ref: `PdoStore <lock-store-pdo >` and
461427:ref: `RedisStore <lock-store-redis >`)
462428guarantee that the lock is acquired only for the defined duration of time. If
463429the task takes longer to be accomplished, then the lock can be released by the
@@ -575,46 +541,6 @@ method uses the Memcached's ``flush()`` method which purges and removes everythi
575541 The method ``flush() `` must not be called, or locks should be stored in a
576542 dedicated Memcached service away from Cache.
577543
578- MongoDbStore
579- ~~~~~~~~~~~~
580-
581- .. caution ::
582-
583- The locked resource name is indexed in the ``_id `` field of the lock
584- collection. Beware that in MongoDB an indexed field's value can be
585- `a maximum of 1024 bytes in length `_ inclusive of structural overhead.
586-
587- A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
588- Such an index can be created manually:
589-
590- .. code-block :: javascript
591-
592- db .lock .ensureIndex (
593- { " expires_at" : 1 },
594- { " expireAfterSeconds" : 0 }
595- )
596-
597- Alternatively, the method ``MongoDbStore::createTtlIndex(int $expireAfterSeconds = 0) ``
598- can be called once to create the TTL index during database setup. Read more
599- about `Expire Data from Collections by Setting TTL `_ in MongoDB.
600-
601- .. tip ::
602-
603- ``MongoDbStore `` will attempt to automatically create a TTL index on MongoDB
604- 2.2+. It's recommended to set constructor option ``gcProbablity = 0.0 `` to
605- disable this behavior if you have manually dealt with TTL index creation.
606-
607- .. caution ::
608-
609- This store relies on all PHP application and database nodes to have
610- synchronized clocks for lock expiry to occur at the correct time. To ensure
611- locks don't expire prematurely; the lock TTL should be set with enough extra
612- time in ``expireAfterSeconds `` to account for any clock drift between nodes.
613-
614- ``writeConcern ``, ``readConcern `` and ``readPreference `` are not specified by
615- MongoDbStore meaning the collection's settings will take effect. Read more
616- about `Replica Set Read and Write Semantics `_ in MongoDB.
617-
618544PdoStore
619545~~~~~~~~~~
620546
@@ -735,13 +661,9 @@ are still running.
735661
736662.. _`ACID` : https://en.wikipedia.org/wiki/ACID
737663.. _`locks` : https://en.wikipedia.org/wiki/Lock_(computer_science)
738- .. _`mongodb/mongodb` : https://packagist.org/packages/mongodb/mongodb
739664.. _Packagist : https://packagist.org/packages/symfony/lock
740665.. _`PHP semaphore functions` : http://php.net/manual/en/book.sem.php
741666.. _`PDO` : https://php.net/pdo
742667.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
743668.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
744669.. _`ZooKeeper` : https://zookeeper.apache.org/
745- .. _`a maximum of 1024 bytes in length` : https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
746- .. _`Expire Data from Collections by Setting TTL` : https://docs.mongodb.com/manual/tutorial/expire-data/
747- .. _`Replica Set Read and Write Semantics` : https://docs.mongodb.com/manual/applications/replication/
0 commit comments