Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extend framework lock configuration reference#11465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:3.4fromHypeMC:extend-framework-lock-configuration-reference
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionscomponents/lock.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,6 +69,8 @@ method can be safely called repeatedly, even if the lock is already acquired.
across several requests. To disable the automatic release behavior, set the
third argument of the ``createLock()`` method to ``false``.

.. _lock-blocking-locks:

Blocking Locks
--------------

Expand Down
132 changes: 130 additions & 2 deletionsreference/configuration/framework.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -87,6 +87,12 @@ Configuration
* `http_method_override`_
* `ide`_
* :ref:`lock <reference-lock>`

* :ref:`enabled <reference-lock-enabled>`
* :ref:`resources <reference-lock-resources>`

* :ref:`name <reference-lock-resources-name>`

* `php_errors`_

* `log`_
Expand DownExpand Up@@ -164,7 +170,7 @@ Configuration
* `engines`_
* :ref:`form <reference-templating-form>`

* `resources`_
*:ref:`resources <reference-templating-form-resources>`

* `hinclude_default_template`_
* `loaders`_
Expand DownExpand Up@@ -1518,6 +1524,8 @@ is disabled. This can be either a template name or the content itself.
form
....

.. _reference-templating-form-resources:

resources
"""""""""

Expand DownExpand Up@@ -2175,11 +2183,131 @@ example, when warming caches offline).
lock
~~~~

**type**: ``string``
**type**: ``string`` | ``array``

The default lock adapter. If not defined, the value is set to ``semaphore`` when
available, or to ``flock`` otherwise. Store's DSN are also allowed.

.. _reference-lock-enabled:

enabled
.......

**type**: ``boolean`` **default**: ``true``

Whether to enable the support for lock or not. This setting is
automatically set to ``true`` when one of the child settings is configured.

.. _reference-lock-resources:

resources
.........

**type**: ``array``

A list of lock stores to be created by the framework extension.

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
framework:
# these are all the supported lock stores
lock: ~
lock: 'flock'
lock: 'semaphore'
lock: 'memcached://m1.docker'
lock: ['memcached://m1.docker', 'memcached://m2.docker']
lock: 'redis://r1.docker'
lock: ['redis://r1.docker', 'redis://r2.docker']
lock: '%env(MEMCACHED_OR_REDIS_URL)%'

# named locks
lock:
invoice: ['redis://r1.docker', 'redis://r2.docker']
report: 'semaphore'

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<framework:config>
<framework:lock>
<!-- these are all the supported lock stores -->
<framework:resource>flock</framework:resource>

<framework:resource>semaphore</framework:resource>

<framework:resource>memcached://m1.docker</framework:resource>

<framework:resource>memcached://m1.docker</framework:resource>
<framework:resource>memcached://m2.docker</framework:resource>

<framework:resource>redis://r1.docker</framework:resource>

<framework:resource>redis://r1.docker</framework:resource>
<framework:resource>redis://r2.docker</framework:resource>

<framework:resource>%env(REDIS_URL)%</framework:resource>

<!-- named locks -->
<framework:resource name="invoice">redis://r1.docker</framework:resource>
<framework:resource name="invoice">redis://r2.docker</framework:resource>
<framework:resource name="report">semaphore</framework:resource>
</framework:lock>
</framework:config>
</container>

.. code-block:: php

// app/config/config.php
$container->loadFromExtension('framework', [
// these are all the supported lock stores
'lock' => null,
'lock' => 'flock',
'lock' => 'semaphore',
'lock' => 'memcached://m1.docker',
'lock' => ['memcached://m1.docker', 'memcached://m2.docker'],
'lock' => 'redis://r1.docker',
'lock' => ['redis://r1.docker', 'redis://r2.docker'],
'lock' => '%env(MEMCACHED_OR_REDIS_URL)%',

// named locks
'lock' => [
'invoice' => ['redis://r1.docker', 'redis://r2.docker'],
'report' => 'semaphore',
],
]);

.. _reference-lock-resources-name:

name
""""

**type**: ``prototype``

Name of the lock you want to create.

.. tip::

If you want to use the `RetryTillSaveStore` for :ref:`non-blocking locks <lock-blocking-locks>`,
you can do it by :doc:`decorating the store </service_container/service_decoration>` service:

.. code-block:: yaml

lock.invoice.retry_till_save.store:
class: Symfony\Component\Lock\Store\RetryTillSaveStore
decorates: lock.invoice.store
arguments: ['@lock.invoice.retry.till.save.store.inner', 100, 50]

workflows
~~~~~~~~~

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp