10000 Minor tweaks · symfony/symfony-docs@47e1741 · GitHub
[go: up one dir, main page]

Skip to content

Commit 47e1741

Browse files
committed
Minor tweaks
1 parent 9c96209 commit 47e1741

File tree

1 file changed

+29
-34
lines changed

1 file changed

+29
-34
lines changed

components/lock.rst

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -224,29 +224,29 @@ MongoDbStore
224224
.. versionadded:: 4.3
225225
The MongoDbStore was introduced Symfony 4.3.
226226

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::
230230

231231
use Symfony\Component\Lock\Store\MongoDbStore;
232232

233233
$mongoClient = new \MongoDB\Client('mongo://localhost/');
234234

235-
$options = array(
235+
$options = [
236236
'database' => 'my-app',
237-
);
237+
];
238238

239239
$store = new MongoDbStore($mongoClient, $options);
240240

241241
The ``MongoDbStore`` takes the following ``$options``:
242242

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+
============ ========= ========================================================================
250250

251251
.. _lock-store-pdo:
252252

@@ -532,15 +532,11 @@ MongoDbStore
532532

533533
.. caution::
534534

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.
541538

542539
A TTL index MUST BE used on MongoDB 2.2+ to automatically clean up expired locks.
543-
544540
Such an index can be created manually:
545541

546542
.. code-block:: javascript
@@ -551,29 +547,25 @@ Such an index can be created manually:
551547
)
552548
553549
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.
557552

558553
.. tip::
559554

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.
564558

565559
.. caution::
566560

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.
572565

573566
``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.
577569

578570
PdoStore
579571
~~~~~~~~~~
@@ -702,3 +694,6 @@ are still running.
702694
.. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php
703695
.. _`Data Source Name (DSN)`: https://en.wikipedia.org/wiki/Data_source_name
704696
.. _`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

Comments
 (0)
0