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::
468468 file_put_contents($file, $dumper->dump());
469469 }
470470
471-
472471.. tip ::
473472
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.
478478
479479``ProjectServiceContainer `` is the default name given to the dumped container
480480class. 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::
567567
568568 require_once $file;
569569 $container = new MyCachedContainer();
570-
571- .. note ::
572-
573- Using `$containerConfigCache->write ` also makes sure that
574- the file write operation is atomic.
575570
576571Now the cached dumped container is used regardless of whether debug mode
577572is 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::
291291
292292 The option to set a suffix in ``tempnam() `` was introduced in Symfony 5.1.
293293
294+ .. _filesystem-dumpfile :
295+
294296``dumpFile ``
295297~~~~~~~~~~~~
296298
You can’t perform that action at this time.
0 commit comments