@@ -224,29 +224,29 @@ MongoDbStore
224
224
.. versionadded :: 4.3
225
225
The MongoDbStore was introduced Symfony 4.3.
226
226
227
- The MongoDbStore saves locks on a MongoDB server, it requires a `` \MongoDB\Client ``
228
- connection from `mongodb/mongodb `_.
229
- This store does not support blocking and expects a TTL to avoid stalled locks::
227
+ The MongoDbStore saves locks on a MongoDB server, it requires a
228
+ `` \MongoDB\Client `` connection from `mongodb/mongodb `_. This store does not
229
+ support blocking and expects a TTL to avoid stalled locks::
230
230
231
231
use Symfony\Component\Lock\Store\MongoDbStore;
232
232
233
233
$mongoClient = new \MongoDB\Client('mongo://localhost/');
234
234
235
- $options = array(
235
+ $options = [
236
236
'database' => 'my-app',
237
- ) ;
237
+ ] ;
238
238
239
239
$store = new MongoDbStore($mongoClient, $options);
240
240
241
241
The ``MongoDbStore `` takes the following ``$options ``:
242
242
243
- ============ ========= ========================================================================
244
- Option Default Description
245
- ============ ========= ========================================================================
246
- database The name of the database [Mandatory]
247
- collection ``lock `` The name of the collection
248
- gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
249
- ============ ========= ========================================================================
243
+ ============ ========= ========================================================================
244
+ Option Default Description
245
+ ============ ========= ========================================================================
246
+ database The name of the database [Mandatory]
247
+ collection ``lock `` The name of the collection
248
+ gcProbablity ``0.001 `` Should a TTL Index be created expressed as a probability from 0.0 to 1.0
249
+ ============ ========= ========================================================================
250
250
251
251
.. _lock-store-pdo :
252
252
@@ -532,15 +532,11 @@ MongoDbStore
532
532
533
533
.. caution ::
534
534
535
- The locked resouce name is indexed in the ``_id `` field of the
536
- lock collection.
537
- An indexed field's value in MongoDB can be a maximum of 1024 bytes in
538
- length inclusive of structural overhead.
539
-
540
- For more details see: https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
535
+ The locked resource name is indexed in the ``_id `` field of the lock
536
+ collection. Beware that in MongoDB an indexed field's value can be
537
+ `a maximum of 1024 bytes in length `_ inclusive of structural overhead.
541
538
542
539
A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
543
-
544
540
Such an index can be created manually:
545
541
546
542
.. code-block :: javascript
@@ -551,29 +547,25 @@ Such an index can be created manually:
551
547
)
552
548
553
549
Alternatively, the method ``MongoDbStore::createTtlIndex(int $expireAfterSeconds = 0) ``
554
- can be called once to create the TTL index during database setup.
555
-
556
- For more details see: http://docs.mongodb.org/manual/tutorial/expire-data/
550
+ can be called once to create the TTL index during database setup. Read more
551
+ about `Expire Data from Collections by Setting TTL `_ in MongoDB.
557
552
558
553
.. tip ::
559
554
560
- ``MongoDbStore `` will attempt to automatically create a TTL index on
561
- mongodb 2.2+. It's recommended to set constructor option
562
- ``gcProbablity = 0.0 `` to disable this behaviour if you have manually
563
- dealt with TTL index creation.
555
+ ``MongoDbStore `` will attempt to automatically create a TTL index on MongoDB
556
+ 2.2+. It's recommended to set constructor option ``gcProbablity = 0.0 `` to
557
+ disable this behavior if you have manually dealt with TTL index creation.
564
558
565
559
.. caution ::
566
560
567
- This store relies on all php application and database nodes to have
568
- synchronized clocks for lock expiry to occur at the correct time.
569
- To ensure locks don't expire prematurely; the lock TTL should be set
570
- with enough extra time in ``expireAfterSeconds `` to account for any
571
- clock drift between nodes.
561
+ This store relies on all PHP application and database nodes to have
562
+ synchronized clocks for lock expiry to occur at the correct time. To ensure
563
+ locks don't expire prematurely; the lock TTL should be set with enough extra
564
+ time in ``expireAfterSeconds `` to account for any clock drift between nodes.
572
565
573
566
``writeConcern ``, ``readConcern `` and ``readPreference `` are not specified by
574
- MongoDbStore meaning the collection's settings will take effect.
575
-
576
- For more details see: https://docs.mongodb.com/manual/applications/replication/
567
+ MongoDbStore meaning the collection's settings will take effect. Read more
568
+ about `Replica Set Read and Write Semantics `_ in MongoDB.
577
569
578
570
PdoStore
579
571
~~~~~~~~~~
@@ -702,3 +694,6 @@ are still running.
702
694
.. _`Doctrine DBAL Connection` : https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
703
695
.. _`Data Source Name (DSN)` : https://en.wikipedia.org/wiki/Data_source_name
704
696
.. _`ZooKeeper` : https://zookeeper.apache.org/
697
+ .. _`a maximum of 1024 bytes in length` : https://docs.mongodb.com/manual/reference/limits/#Index-Key-Limit
698
+ .. _`Expire Data from Collections by Setting TTL` : https://docs.mongodb.com/manual/tutorial/expire-data/
699
+ .. _`Replica Set Read and Write Semantics` : https://docs.mongodb.com/manual/applications/replication/
0 commit comments