@@ -144,6 +144,12 @@ Configuration
144
144
* `http_method_override `_
145
145
* `ide `_
146
146
* :ref: `lock <reference-lock >`
147
+
148
+ * :ref: `enabled <reference-lock-enabled >`
149
+ * :ref: `resources <reference-lock-resources >`
150
+
151
+ * :ref: `name <reference-lock-resources-name >`
152
+
147
153
* `php_errors `_
148
154
149
155
* `log `_
@@ -2595,11 +2601,131 @@ example, when warming caches offline).
2595
2601
lock
2596
2602
~~~~
2597
2603
2598
- **type **: ``string ``
2604
+ **type **: ``string `` | `` array ``
2599
2605
2600
2606
The default lock adapter. If not defined, the value is set to ``semaphore `` when
2601
2607
available, or to ``flock `` otherwise. Store's DSN are also allowed.
2602
2608
2609
+ .. _reference-lock-enabled :
2610
+
2611
+ enabled
2612
+ .......
2613
+
2614
+ **type **: ``boolean `` **default **: ``true ``
2615
+
2616
+ Whether to enable the support for lock or not. This setting is
2617
+ automatically set to ``true `` when one of the child settings is configured.
2618
+
2619
+ .. _reference-lock-resources :
2620
+
2621
+ resources
2622
+ .........
2623
+
2624
+ **type **: ``array ``
2625
+
2626
+ A list of lock stores to be created by the framework extension.
2627
+
2628
+ .. configuration-block ::
2629
+
2630
+ .. code-block :: yaml
2631
+
2632
+ # app/config/config.yml
2633
+ framework :
2634
+ # these are all the supported lock stores
2635
+ lock : ~
2636
+ lock : ' flock'
2637
+ lock : ' semaphore'
2638
+ lock : ' memcached://m1.docker'
2639
+ lock : ['memcached://m1.docker', 'memcached://m2.docker']
2640
+ lock : ' redis://r1.docker'
2641
+ lock : ['redis://r1.docker', 'redis://r2.docker']
2642
+ lock : ' %env(MEMCACHED_OR_REDIS_URL)%'
2643
+
2644
+ # named locks
2645
+ lock :
2646
+ invoice : ['redis://r1.docker', 'redis://r2.docker']
2647
+ report : ' semaphore'
2648
+
2649
+ .. code-block :: xml
2650
+
2651
+ <!-- app/config/config.xml -->
2652
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2653
+ <container xmlns =" http://symfony.com/schema/dic/services"
2654
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2655
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
2656
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
2657
+ https://symfony.com/schema/dic/services/services-1.0.xsd
2658
+ http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
2659
+
2660
+ <framework : config >
2661
+ <framework : lock >
2662
+ <!-- these are all the supported lock stores -->
2663
+ <framework : resource >flock</framework : resource >
2664
+
2665
+ <framework : resource >semaphore</framework : resource >
2666
+
2667
+ <framework : resource >memcached://m1.docker</framework : resource >
2668
+
2669
+ <framework : resource >memcached://m1.docker</framework : resource >
2670
+ <framework : resource >memcached://m2.docker</framework : resource >
2671
+
2672
+ <framework : resource >redis://r1.docker</framework : resource >
2673
+
2674
+ <framework : resource >redis://r1.docker</framework : resource >
2675
+ <framework : resource >redis://r2.docker</framework : resource >
2676
+
2677
+ <framework : resource >%env(REDIS_URL)%</framework : resource >
2678
+
2679
+ <!-- named locks -->
2680
+ <framework : resource name =" invoice" >redis://r1.docker</framework : resource >
2681
+ <framework : resource name =" invoice" >redis://r2.docker</framework : resource >
2682
+ <framework : resource name =" report" >semaphore</framework : resource >
2683
+ </framework : lock >
2684
+ </framework : config >
2685
+ </container >
2686
+
2687
+ .. code-block :: php
2688
+
2689
+ // app/config/config.php
2690
+ $container->loadFromExtension('framework', [
2691
+ // these are all the supported lock stores
2692
+ 'lock' => null,
2693
+ 'lock' => 'flock',
2694
+ 'lock' => 'semaphore',
2695
+ 'lock' => 'memcached://m1.docker',
2696
+ 'lock' => ['memcached://m1.docker', 'memcached://m2.docker'],
2697
+ 'lock' => 'redis://r1.docker',
2698
+ 'lock' => ['redis://r1.docker', 'redis://r2.docker'],
2699
+ 'lock' => '%env(MEMCACHED_OR_REDIS_URL)%',
2700
+
2701
+ // named locks
2702
+ 'lock' => [
2703
+ 'invoice' => ['redis://r1.docker', 'redis://r2.docker'],
2704
+ 'report' => 'semaphore',
2705
+ ],
2706
+ ]);
2707
+
2708
+ .. _reference-lock-resources-name :
2709
+
2710
+ name
2711
+ """"
2712
+
2713
+ **type **: ``prototype ``
2714
+
2715
+ Name of the lock you want to create.
2716
+
2717
+ .. tip ::
2718
+
2719
+ If you want to use the `RetryTillSaveStore ` for :ref: `non-blocking locks <lock-blocking-locks >`,
2720
+ you can do it by :doc: `decorating the store </service_container/service_decoration >` service:
2721
+
2722
+ .. code-block :: yaml
2723
+
2724
+ lock.invoice.retry_till_save.store :
2725
+ class : Symfony\Component\Lock\Store\RetryTillSaveStore
2726
+ decorates : lock.invoice.store
2727
+ arguments : ['@lock.invoice.retry.till.save.store.inner', 100, 50]
2728
+
2603
2729
workflows
2604
2730
~~~~~~~~~
2605
2731
0 commit comments