Skip to content

Commit 25961bd

Browse files
committed
Show how to configure lifetime for app.cache.
This will fix #10988
1 parent 1b8aacb commit 25961bd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cache.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
250250
# config/packages/cache.yaml
251251
framework:
252252
cache:
253+
app: my_configured_app_cache
253254
pools:
254255
my_cache_pool:
255256
adapter: cache.adapter.memcached
@@ -260,6 +261,10 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
260261
cache.long_cache:
261262
adapter: my_cache_pool
262263
default_lifetime: 604800
264+
my_configured_app_cache:
265+
# "cache.adapter.filesystem" is the default for "cache.app"
266+
adapter: cache.adapter.filesystem
267+
default_lifetime: 3600
263268
264269
.. code-block:: xml
265270
@@ -272,10 +277,12 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
272277
https://symfony.com/schema/dic/services/services-1.0.xsd">
273278
274279
<framework:config>
275-
<framework:cache>
280+
<framework:cache app="my_cache_pool">
276281
<framework:pool name="my_cache_pool" adapter="cache.adapter.memcached" provider="memcached://user:[email protected]"/>
277282
<framework:pool name="cache.short_cache" adapter="my_cache_pool" default_lifetime="604800"/>
278283
<framework:pool name="cache.long_cache" adapter="my_cache_pool" default_lifetime="604800"/>
284+
<!-- "cache.adapter.filesystem" is the default for "cache.app" -->
285+
<framework:pool name="my_configured_app_cache" adapter="cache.adapter.filesystem" default_lifetime="3600"/>
279286
</framework:cache>
280287
</framework:config>
281288
</container>
@@ -285,6 +292,7 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
285292
// config/packages/cache.php
286293
$container->loadFromExtension('framework', [
287294
'cache' => [
295+
'app' => 'my_configured_app_cache',
288296
'pools' => [
289297
'my_cache_pool' => [
290298
'adapter' => 'cache.adapter.memcached',
@@ -298,6 +306,11 @@ For advanced configurations it could sometimes be useful to use a pool as an ada
298306
'adapter' => 'cache.adapter.memcached',
299307
'default_lifetime' => 604800,
300308
],
309+
'my_configured_app_cache' => [
310+
// "cache.adapter.filesystem" is the default for "cache.app"
311+
'adapter' => 'cache.adapter.filesystem',
312+
'default_lifetime' => 3600,
313+
],
301314
],
302315
],
303316
]);

0 commit comments

Comments
 (0)