File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
components/dependency_injection Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -468,6 +468,14 @@ serves at dumping the compiled container::
468
468
file_put_contents($file, $dumper->dump());
469
469
}
470
470
471
+
472
+ .. tip ::
473
+
474
+ Call to `file_put_contents ` is not atomic. When generating container in
475
+ a production environment with multiple concurrent requests, use `dumpFile `
476
+ from `component-filesystem ` instead. This generates file in tmp and moves it
477
+ to its destination only once it's fully written to.
478
+
471
479
``ProjectServiceContainer `` is the default name given to the dumped container
472
480
class. However, you can change this with the ``class `` option when you
473
481
dump it::
@@ -559,6 +567,11 @@ for these resources and use them as metadata for the cache::
559
567
560
568
require_once $file;
561
569
$container = new MyCachedContainer();
570
+
571
+ .. note ::
572
+
573
+ Using `$containerConfigCache->write ` also makes sure that
574
+ the file write operation is atomic.
562
575
563
576
Now the cached dumped container is used regardless of whether debug mode
564
577
is on or not. The difference is that the ``ConfigCache `` is set to debug
You can’t perform that action at this time.
0 commit comments