Skip to content

Commit b0b4536

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: Add the versionadded directive [Lock] Add DynamoDbStore
2 parents 0efb8aa + 268f693 commit b0b4536

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

β€Žcomponents/lock.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ Store Scope Blocking Ex
399399
:ref:`RedisStore <lock-store-redis>` remote no yes yes yes
400400
:ref:`SemaphoreStore <lock-store-semaphore>` local yes no no no
401401
:ref:`ZookeeperStore <lock-store-zookeeper>` remote no no no no
402+
:ref:`DynamoDbStore <lock-store-dynamodb>` remote no yes no yes
402403
========================================================== ====== ======== ======== ======= =============
403404

404405
.. tip::
@@ -695,6 +696,32 @@ PHP process is terminated::
695696
Zookeeper does not require a TTL as the nodes used for locking are ephemeral
696697
and die when the PHP process is terminated.
697698

699+
.. _lock-store-dynamodb:
700+
701+
DynamoDbStore
702+
~~~~~~~~~~~~~
703+
704+
The DynamoDbStore saves locks on a Amazon DynamoDB table. Install it by running:
705+
706+
.. code-block:: terminal
707+
708+
$ composer require symfony/amazon-dynamodb-lock
709+
710+
It requires a `DynamoDbClient`_ instance or a `Data Source Name (DSN)`_.
711+
This store does not support blocking, and expects a TTL to avoid stalled locks::
712+
713+
use Symfony\Component\Lock\Bridge\DynamoDb\Store\DynamoDbStore;
714+
715+
// a DynamoDbClient instance or DSN
716+
$dynamoDbClientOrDSN = 'dynamodb://default/lock';
717+
$store = new DynamoDbStore($dynamoDbClientOrDSN);
718+
719+
The table where values are stored is created automatically on the first call to
720+
the :method:`Symfony\\Component\\Lock\\Bridge\\DynamoDb\\DynamoDbStore::save` method.
721+
You can also create this table explicitly by calling the
722+
:method:`Symfony\\Component\\Lock\\Bridge\\DynamoDb\\DynamoDbStore::createTable` method in
723+
your code.
724+
698725
Reliability
699726
-----------
700727

@@ -1046,3 +1073,4 @@ are still running.
10461073
.. _`readers-writer lock`: https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock
10471074
.. _`priority policy`: https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Priority_policies
10481075
.. _`PCNTL`: https://www.php.net/manual/book.pcntl.php
1076+
.. _`DynamoDbClient`: https://async-aws.com/clients/dynamodb.html

β€Žlock.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ this behavior by using the ``lock`` key like:
6161
lock: 'sqlsrv:server=127.0.0.1;Database=app'
6262
lock: 'oci:host=127.0.0.1;dbname=app'
6363
lock: 'mongodb://127.0.0.1/app?collection=lock'
64+
lock: 'dynamodb://127.0.0.1/lock'
6465
lock: '%env(LOCK_DSN)%'
6566
# using an existing service
6667
lock: 'snc_redis.default'
@@ -119,6 +120,8 @@ this behavior by using the ``lock`` key like:
119120
120121
<framework:resource>mongodb://127.0.0.1/app?collection=lock</framework:resource>
121122
123+
<framework:resource>dynamodb://127.0.0.1/lock</framework:resource>
124+
122125
<framework:resource>%env(LOCK_DSN)%</framework:resource>
123126
124127
<!-- using an existing service -->
@@ -157,6 +160,7 @@ this behavior by using the ``lock`` key like:
157160
->resource('default', ['sqlsrv:server=127.0.0.1;Database=app'])
158161
->resource('default', ['oci:host=127.0.0.1;dbname=app'])
159162
->resource('default', ['mongodb://127.0.0.1/app?collection=lock'])
163+
->resource('default', ['dynamodb://127.0.0.1/lock'])
160164
->resource('default', [env('LOCK_DSN')])
161165
// using an existing service
162166
->resource('default', ['snc_redis.default'])

0 commit comments

Comments
 (0)