File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -468,13 +468,13 @@ serves at dumping the compiled container::
468
468
file_put_contents($file, $dumper->dump());
469
469
}
470
470
471
-
472
471
.. tip ::
473
472
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.
473
+ The ``file_put_contents() `` function is not atomic. That could cause issues
474
+ in a production environment with multiple concurrent requests. Instead, use
475
+ the :ref: `dumpFile() method <filesystem-dumpfile >` from Symfony Filesystem
476
+ component or other methods provided by Symfony (e.g. ``$containerConfigCache->write() ``)
477
+ which are atomic.
478
478
479
479
``ProjectServiceContainer `` is the default name given to the dumped container
480
480
class. However, you can change this with the ``class `` option when you
@@ -567,11 +567,6 @@ for these resources and use them as metadata for the cache::
567
567
568
568
require_once $file;
569
569
$container = new MyCachedContainer();
570
-
571
- .. note ::
572
-
573
- Using `$containerConfigCache->write ` also makes sure that
574
- the file write operation is atomic.
575
570
576
571
Now the cached dumped container is used regardless of whether debug mode
577
572
is on or not. The difference is that the ``ConfigCache `` is set to debug
Original file line number Diff line number Diff line change @@ -291,6 +291,8 @@ exception on failure::
291
291
292
292
The option to set a suffix in ``tempnam() `` was introduced in Symfony 5.1.
293
293
294
+ .. _filesystem-dumpfile :
295
+
294
296
``dumpFile ``
295
297
~~~~~~~~~~~~
296
298
You can’t perform that action at this time.
0 commit comments