Skip to content

Commit 0614f97

Browse files
[HttpKernel] Add mention to the shared cache directory
1 parent c805014 commit 0614f97

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

configuration/override_dir_structure.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ named ``APP_CACHE_DIR`` whose value is the full path of the cache folder.
118118
its own cached configuration files, and so each needs its own directory to
119119
store those cache files.
120120

121+
In case you have multiple frontend servers using the same shared filesystem, you
122+
can make use of the :method:`Symfony\\Component\\HttpKernel\\Kernel::getShareDir` method to
123+
get a shared directory for cache and shared data. The shared directory can be set
124+
by overriding an environment variable named ``APP_SHARE_DIR`` whose value is the full
125+
path of the shared folder. This directory is also accessible as a container parameter
126+
named ``%kernel.share_dir%``.
127+
128+
.. versionadded:: 7.4
129+
130+
The ``Kernel::getShareDir()`` method, the ``%kernel.share_dir`` parameter and
131+
the support for the ``APP_SHARE_DIR`` environment variable were introduced
132+
in Symfony 7.4.
133+
121134
.. _override-logs-dir:
122135

123136
Override the Log Directory

reference/configuration/kernel.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,22 @@ servers support it, and you have to use a long-running web server like `FrankenP
347347
This parameter stores the value of
348348
:ref:`the framework.secret parameter <configuration-framework-secret>`.
349349

350+
``kernel.share_dir``
351+
--------------------
352+
353+
**type**: ``string`` **default**: ``$this->getCacheDir()``
354+
355+
This parameter stores the absolute path of the shared cache directory of your Symfony
356+
application. The default value is the current cache directory.
357+
358+
This value is also exposed via the :method:`Symfony\\Component\\HttpKernel\\Kernel::getShareDir`
359+
method of the kernel class, which you can override to return a different value.
360+
361+
.. versionadded:: 7.4
362+
363+
The ``Kernel::getShareDir()`` method and the ``%kernel.share_dir`` parameter
364+
were introduced in Symfony 7.4.
365+
350366
``kernel.trust_x_sendfile_type_header``
351367
---------------------------------------
352368

0 commit comments

Comments
 (0)