@@ -171,7 +171,6 @@ Store Scope Blocking Expiring
171171============================================ ====== ======== ========
172172:ref: `FlockStore <lock-store-flock >` local yes no
173173:ref: `MemcachedStore <lock-store-memcached >` remote no yes
174- :ref: `MongoDbStore <lock-store-mongodb >` remote no yes
175174:ref: `PdoStore <lock-store-pdo >` remote no yes
176175:ref: `RedisStore <lock-store-redis >` remote no yes
177176:ref: `SemaphoreStore <lock-store-semaphore >` local yes no
@@ -218,39 +217,6 @@ support blocking, and expects a TTL to avoid stalled locks::
218217
219218 Memcached does not support TTL lower than 1 second.
220219
221- .. _lock-store-mongodb :
222-
223- MongoDbStore
224- ~~~~~~~~~~~~
225-
226- .. versionadded :: 4.3
227-
228- The ``MongoDbStore `` was introduced in Symfony 4.3.
229-
230- The MongoDbStore saves locks on a MongoDB server, it requires a
231- ``\MongoDB\Client `` connection from `mongodb/mongodb `_. This store does not
232- support blocking and expects a TTL to avoid stalled locks::
233-
234- use Symfony\Component\Lock\Store\MongoDbStore;
235-
236- $mongoClient = new \MongoDB\Client('mongo://localhost/');
237-
238- $options = [
239- 'database' => 'my-app',
240- ];
241-
242- $store = new MongoDbStore($mongoClient, $options);
243-
244- The ``MongoDbStore `` takes the following ``$options ``:
245-
246- ============ ========= ========================================================================
247- Option Default Description
248- ============ ========= ========================================================================
249- database The name of the database [Mandatory]
250- collection ``lock `` The name of the collection
251- gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
252- ============ ========= ========================================================================
253-
254220.. _lock-store-pdo :
255221
256222PdoStore
@@ -387,7 +353,7 @@ Remote Stores
387353~~~~~~~~~~~~~
388354
389355Remote stores (:ref: `MemcachedStore <lock-store-memcached >`,
390- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >`,
356+ :ref: `PdoStore <lock-store-pdo >`,
391357:ref: `RedisStore <lock-store-redis >` and
392358:ref: `ZookeeperStore <lock-store-zookeeper >`) use a unique token to recognize
393359the true owner of the lock. This token is stored in the
@@ -412,7 +378,7 @@ Expiring Stores
412378~~~~~~~~~~~~~~~
413379
414380Expiring stores (:ref: `MemcachedStore <lock-store-memcached >`,
415- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >` and
381+ :ref: `PdoStore <lock-store-pdo >` and
416382:ref: `RedisStore <lock-store-redis >`)
417383guarantee that the lock is acquired only for the defined duration of time. If
418384the task takes longer to be accomplished, then the lock can be released by the
@@ -530,46 +496,6 @@ method uses the Memcached's ``flush()`` method which purges and removes everythi
530496 The method ``flush() `` must not be called, or locks should be stored in a
531497 dedicated Memcached service away from Cache.
532498
533- MongoDbStore
534- ~~~~~~~~~~~~
535-
536- .. caution ::
537-
538- The locked resource name is indexed in the ``_id `` field of the lock
539- collection. Beware that in MongoDB an indexed field's value can be
540- `a maximum of 1024 bytes in length `_ inclusive of structural overhead.
541-
542- A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
543- Such an index can be created manually:
544-
545- .. code-block :: javascript
546-
547- db .lock .ensureIndex (
548- { " expires_at" : 1 },
549- { " expireAfterSeconds" : 0 }
550- )
551-
552- Alternatively, the method ``MongoDbStore::createTtlIndex(int $expireAfterSeconds = 0) ``
553- can be called once to create the TTL index during database setup. Read more
554- about `Expire Data from Collections by Setting TTL `_ in MongoDB.
555-
556- .. tip ::
557-
558- ``MongoDbStore `` will attempt to automatically create a TTL index on MongoDB
559- 2.2+. It's recommended to set constructor option ``gcProbablity = 0.0 `` to
560- disable this behavior if you have manually dealt with TTL index creation.
561-
562- .. caution ::
563-
564- This store relies on all PHP application and database nodes to have
565- synchronized clocks for lock expiry to occur at the correct time. To ensure
566- locks don't expire prematurely; the lock TTL should be set with enough extra
567- time in ``expireAfterSeconds `` to account for any clock drift between nodes.
568-
569- ``writeConcern ``, ``readConcern `` and ``readPreference `` are not specified by
570- MongoDbStore meaning the collection's settings will take effect. Read more
571- about `Replica Set Read and Write Semantics `_ in MongoDB.
572-
573499PdoStore
574500~~~~~~~~~~
575501
@@ -690,13 +616,9 @@ are still running.
690616
691617.. _`ACID` : https://en.wikipedia.org/wiki/ACID
692618.. _`locks` : https://en.wikipedia.org/wiki/Lock_(computer_science)
693- .. _`mongodb/mongodb` : https://packagist.org/packages/mongodb/mongodb
694619.. _Packagist : https://packagist.org/packages/symfony/lock
695620.. _`PHP semaphore functions` : http://php.net/manual/en/book.sem.php
696621.. _`PDO` : https://php.net/pdo
697622.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
698623.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
699624.. _`ZooKeeper` : https://zookeeper.apache.org/
700- .. _`a maximum of 1024 bytes in length` : https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
701- .. _`Expire Data from Collections by Setting TTL` : https://docs.mongodb.com/manual/tutorial/expire-data/
702- .. _`Replica Set Read and Write Semantics` : https://docs.mongodb.com/manual/applications/replication/
0 commit comments