@@ -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,35 +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- The MongoDbStore saves locks on a MongoDB server, it requires a
272- ``\MongoDB\Client `` connection from `mongodb/mongodb `_. This store does not
273- support blocking and expects a TTL to avoid stalled locks::
274-
275- use Symfony\Component\Lock\Store\MongoDbStore;
276-
277- $mongoClient = new \MongoDB\Client('mongo://localhost/');
278-
279- $options = [
280- 'database' => 'my-app',
281- ];
282-
283- $store = new MongoDbStore($mongoClient, $options);
284-
285- The ``MongoDbStore `` takes the following ``$options ``:
286-
287- ============ ========= ========================================================================
288- Option Default Description
289- ============ ========= ========================================================================
290- database The name of the database [Mandatory]
291- collection ``lock `` The name of the collection
292- gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
293- ============ ========= ========================================================================
294-
295265.. _lock-store-pdo :
296266
297267PdoStore
@@ -428,7 +398,7 @@ Remote Stores
428398~~~~~~~~~~~~~
429399
430400Remote stores (:ref: `MemcachedStore <lock-store-memcached >`,
431- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >`,
401+ :ref: `PdoStore <lock-store-pdo >`,
432402:ref: `RedisStore <lock-store-redis >` and
433403:ref: `ZookeeperStore <lock-store-zookeeper >`) use a unique token to recognize
434404the true owner of the lock. This token is stored in the
@@ -453,7 +423,7 @@ Expiring Stores
453423~~~~~~~~~~~~~~~
454424
455425Expiring stores (:ref: `MemcachedStore <lock-store-memcached >`,
456- :ref: `MongoDbStore < lock-store-mongodb >`, :ref: ` PdoStore <lock-store-pdo >` and
426+ :ref: `PdoStore <lock-store-pdo >` and
457427:ref: `RedisStore <lock-store-redis >`)
458428guarantee that the lock is acquired only for the defined duration of time. If
459429the task takes longer to be accomplished, then the lock can be released by the
@@ -571,46 +541,6 @@ method uses the Memcached's ``flush()`` method which purges and removes everythi
571541 The method ``flush() `` must not be called, or locks should be stored in a
572542 dedicated Memcached service away from Cache.
573543
574- MongoDbStore
575- ~~~~~~~~~~~~
576-
577- .. caution ::
578-
579- The locked resource name is indexed in the ``_id `` field of the lock
580- collection. Beware that in MongoDB an indexed field's value can be
581- `a maximum of 1024 bytes in length `_ inclusive of structural overhead.
582-
583- A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
584- Such an index can be created manually:
585-
586- .. code-block :: javascript
587-
588- db .lock .ensureIndex (
589- { " expires_at" : 1 },
590- { " expireAfterSeconds" : 0 }
591- )
592-
593- Alternatively, the method ``MongoDbStore::createTtlIndex(int $expireAfterSeconds = 0) ``
594- can be called once to create the TTL index during database setup. Read more
595- about `Expire Data from Collections by Setting TTL `_ in MongoDB.
596-
597- .. tip ::
598-
599- ``MongoDbStore `` will attempt to automatically create a TTL index on MongoDB
600- 2.2+. It's recommended to set constructor option ``gcProbablity = 0.0 `` to
601- disable this behavior if you have manually dealt with TTL index creation.
602-
603- .. caution ::
604-
605- This store relies on all PHP application and database nodes to have
606- synchronized clocks for lock expiry to occur at the correct time. To ensure
607- locks don't expire prematurely; the lock TTL should be set with enough extra
608- time in ``expireAfterSeconds `` to account for any clock drift between nodes.
609-
610- ``writeConcern ``, ``readConcern `` and ``readPreference `` are not specified by
611- MongoDbStore meaning the collection's settings will take effect. Read more
612- about `Replica Set Read and Write Semantics `_ in MongoDB.
613-
614544PdoStore
615545~~~~~~~~~~
616546
@@ -731,13 +661,9 @@ are still running.
731661
732662.. _`ACID` : https://en.wikipedia.org/wiki/ACID
733663.. _`locks` : https://en.wikipedia.org/wiki/Lock_(computer_science)
734- .. _`mongodb/mongodb` : https://packagist.org/packages/mongodb/mongodb
735664.. _Packagist : https://packagist.org/packages/symfony/lock
736665.. _`PHP semaphore functions` : http://php.net/manual/en/book.sem.php
737666.. _`PDO` : https://php.net/pdo
738667.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
739668.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
740669.. _`ZooKeeper` : https://zookeeper.apache.org/
741- .. _`a maximum of 1024 bytes in length` : https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
742- .. _`Expire Data from Collections by Setting TTL` : https://docs.mongodb.com/manual/tutorial/expire-data/
743- .. _`Replica Set Read and Write Semantics` : https://docs.mongodb.com/manual/applications/replication/
0 commit comments