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

Commitcfdb6b0

Browse files
committed
minor#11465 Extend framework lock configuration reference (HypeMC)
This PR was merged into the 3.4 branch.Discussion----------Extend framework lock configuration referenceFixes#9779.This extends the documentation for the framework bundle lock integration which was add withsymfony/symfony@e5ddd14 .The only current documentation is a blog post:https://symfony.com/blog/new-in-symfony-3-3-lock-component .**NOTE 1**: The xml configuration doesn't currently work, seesymfony/symfony#31197**NOTE 2**: There is an additional PR for the `flock://` option which was added in Symofny 4.2, see#11466Commits-------d0161b4 Extend framework lock configuration reference
2 parents4d65cec +d0161b4 commitcfdb6b0

File tree

2 files changed

+132
-2
lines changed

2 files changed

+132
-2
lines changed

‎components/lock.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ method can be safely called repeatedly, even if the lock is already acquired.
6969
across several requests. To disable the automatic release behavior, set the
7070
third argument of the ``createLock()`` method to ``false``.
7171

72+
.. _lock-blocking-locks:
73+
7274
Blocking Locks
7375
--------------
7476

‎reference/configuration/framework.rst‎

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ Configuration
8787
* `http_method_override`_
8888
* `ide`_
8989
*:ref:`lock<reference-lock>`
90+
91+
*:ref:`enabled<reference-lock-enabled>`
92+
*:ref:`resources<reference-lock-resources>`
93+
94+
*:ref:`name<reference-lock-resources-name>`
95+
9096
* `php_errors`_
9197

9298
* `log`_
@@ -165,7 +171,7 @@ Configuration
165171
* `engines`_
166172
*:ref:`form<reference-templating-form>`
167173

168-
* `resources`_
174+
*:ref:`resources<reference-templating-form-resources>`
169175

170176
* `hinclude_default_template`_
171177
* `loaders`_
@@ -1564,6 +1570,8 @@ is disabled. This can be either a template name or the content itself.
15641570
form
15651571
....
15661572

1573+
.. _reference-templating-form-resources:
1574+
15671575
resources
15681576
"""""""""
15691577

@@ -2235,11 +2243,131 @@ example, when warming caches offline).
22352243
lock
22362244
~~~~
22372245

2238-
**type**: ``string``
2246+
**type**: ``string`` | ``array``
22392247

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

2251+
.. _reference-lock-enabled:
2252+
2253+
enabled
2254+
.......
2255+
2256+
**type**: ``boolean`` **default**: ``true``
2257+
2258+
Whether to enable the support for lock or not. This setting is
2259+
automatically set to ``true`` when one of the child settings is configured.
2260+
2261+
.. _reference-lock-resources:
2262+
2263+
resources
2264+
.........
2265+
2266+
**type**: ``array``
2267+
2268+
A list of lock stores to be created by the framework extension.
2269+
2270+
..configuration-block::
2271+
2272+
..code-block::yaml
2273+
2274+
# app/config/config.yml
2275+
framework:
2276+
# these are all the supported lock stores
2277+
lock:~
2278+
lock:'flock'
2279+
lock:'semaphore'
2280+
lock:'memcached://m1.docker'
2281+
lock:['memcached://m1.docker', 'memcached://m2.docker']
2282+
lock:'redis://r1.docker'
2283+
lock:['redis://r1.docker', 'redis://r2.docker']
2284+
lock:'%env(MEMCACHED_OR_REDIS_URL)%'
2285+
2286+
# named locks
2287+
lock:
2288+
invoice:['redis://r1.docker', 'redis://r2.docker']
2289+
report:'semaphore'
2290+
2291+
..code-block::xml
2292+
2293+
<!-- app/config/config.xml-->
2294+
<?xml version="1.0" encoding="UTF-8" ?>
2295+
<containerxmlns="http://symfony.com/schema/dic/services"
2296+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2297+
xmlns:framework="http://symfony.com/schema/dic/symfony"
2298+
xsi:schemaLocation="http://symfony.com/schema/dic/services
2299+
https://symfony.com/schema/dic/services/services-1.0.xsd
2300+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
2301+
2302+
<framework:config>
2303+
<framework:lock>
2304+
<!-- these are all the supported lock stores-->
2305+
<framework:resource>flock</framework:resource>
2306+
2307+
<framework:resource>semaphore</framework:resource>
2308+
2309+
<framework:resource>memcached://m1.docker</framework:resource>
2310+
2311+
<framework:resource>memcached://m1.docker</framework:resource>
2312+
<framework:resource>memcached://m2.docker</framework:resource>
2313+
2314+
<framework:resource>redis://r1.docker</framework:resource>
2315+
2316+
<framework:resource>redis://r1.docker</framework:resource>
2317+
<framework:resource>redis://r2.docker</framework:resource>
2318+
2319+
<framework:resource>%env(REDIS_URL)%</framework:resource>
2320+
2321+
<!-- named locks-->
2322+
<framework:resourcename="invoice">redis://r1.docker</framework:resource>
2323+
<framework:resourcename="invoice">redis://r2.docker</framework:resource>
2324+
<framework:resourcename="report">semaphore</framework:resource>
2325+
</framework:lock>
2326+
</framework:config>
2327+
</container>
2328+
2329+
..code-block::php
2330+
2331+
// app/config/config.php
2332+
$container->loadFromExtension('framework', [
2333+
// these are all the supported lock stores
2334+
'lock' => null,
2335+
'lock' => 'flock',
2336+
'lock' => 'semaphore',
2337+
'lock' => 'memcached://m1.docker',
2338+
'lock' => ['memcached://m1.docker', 'memcached://m2.docker'],
2339+
'lock' => 'redis://r1.docker',
2340+
'lock' => ['redis://r1.docker', 'redis://r2.docker'],
2341+
'lock' => '%env(MEMCACHED_OR_REDIS_URL)%',
2342+
2343+
// named locks
2344+
'lock' => [
2345+
'invoice' => ['redis://r1.docker', 'redis://r2.docker'],
2346+
'report' => 'semaphore',
2347+
],
2348+
]);
2349+
2350+
.. _reference-lock-resources-name:
2351+
2352+
name
2353+
""""
2354+
2355+
**type**: ``prototype``
2356+
2357+
Name of the lock you want to create.
2358+
2359+
..tip::
2360+
2361+
If you want to use the `RetryTillSaveStore` for:ref:`non-blocking locks<lock-blocking-locks>`,
2362+
you can do it by:doc:`decorating the store</service_container/service_decoration>` service:
2363+
2364+
..code-block::yaml
2365+
2366+
lock.invoice.retry_till_save.store:
2367+
class:Symfony\Component\Lock\Store\RetryTillSaveStore
2368+
decorates:lock.invoice.store
2369+
arguments:['@lock.invoice.retry.till.save.store.inner', 100, 50]
2370+
22432371
workflows
22442372
~~~~~~~~~
22452373

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp