You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/infrastructure_and_maintenance/cache/persistence_cache.md
+11-42Lines changed: 11 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,10 +17,8 @@ For details on how to reuse this Cache service in your own custom code, see belo
17
17
18
18
## Transparent cache
19
19
20
-
With the persistence cache, like with the HTTP cache, [[= product_name =]] tries to follow principles of transparent caching.
21
-
This can shortly be described as a cache which is invisible to the end user (admin/editors) of [[= product_name =]] where content is always returned *fresh*.
22
-
In other words, there should be no need to manually clear the cache like it was frequently the case with eZ Publish 4.x.
23
-
This is possible thanks to an interface that follows CRUD (Create Read Update Delete) operations per domain.
20
+
With the persistence cache, like with the HTTP cache, [[= product_name =]] follows the principles of transparent caching.
21
+
The cache is invisible to the end user (admin/editors) of [[= product_name =]] and content is always returned *fresh*.
24
22
25
23
## What is cached?
26
24
@@ -46,11 +44,11 @@ To see where and how to contribute additional caches, refer to the [source code]
46
44
47
45
!!! note
48
46
49
-
Current implementation uses Symfony cache.
47
+
Current implementation uses [Symfony application cache]([[= symfony_doc =]]/cache.html#system-cache-and-application-cache).
50
48
It technically supports the following cache backends: [APCu, Array, Chain, Doctrine, Filesystem, PDO & Doctrine DBAL, Php Array, Proxy, Redis]([[= symfony_doc =]]/components/cache/cache_pools.html#creating-cache-pools).
51
-
[[= product_name =]] officially supports only using Filesystem for single server and Redis for clustered setups.
49
+
[[= product_name =]] officially supports only using Filesystem for single server and Redis/Valkey for clustered setups.
52
50
53
-
Use of Redis as shared cache back end is a requirement for use in clustering setup.
51
+
Use of [Redis/Valkey](#redisvalkey) as shared cache backend is a requirement for use in clustering setup.
54
52
For an overview of this feature, see [Clustering](clustering.md).
55
53
Filesystem adapters, for example, are **not** intended to be used over a shared filesystem.
56
54
@@ -233,7 +231,7 @@ And as [[= product_name =]] requires that instances use a cluster-aware cache in
233
231
234
232
#### With dependency injection
235
233
236
-
In your Symfony services configuration you can define that you require the cache service in your configuration like so:
234
+
In your Symfony services configuration you can inject the cache service in your configuration like so:
237
235
238
236
``` yaml
239
237
# yml configuration
@@ -244,41 +242,23 @@ In your Symfony services configuration you can define that you require the cache
244
242
245
243
This service is an instance of `Symfony\Component\Cache\Adapter\TagAwareAdapterInterface`, which extends the `Psr\Cache\CacheItemPoolInterface` interface with tagging functionality.
246
244
247
-
#### With service container
248
-
249
-
Like any other service, you can also get the cache service with the [service container](php_api.md#service-container) like so:
250
-
251
-
``` php
252
-
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
253
-
use Symfony\Component\DependencyInjection\ContainerInterface;
254
-
255
-
// Getting the cache service in PHP
256
-
257
-
/** @var ContainerInterface $container */
258
-
$pool = $container->get('ibexa.cache_pool');
259
-
/** @var TagAwareAdapterInterface $pool */
260
-
```
261
-
262
245
### Using the cache service
263
246
264
247
Example usage of the cache service:
265
248
266
249
``` php
267
250
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
268
-
use Symfony\Component\DependencyInjection\ContainerInterface;
Copy file name to clipboardExpand all lines: docs/infrastructure_and_maintenance/devops.md
+56-17Lines changed: 56 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,42 +6,81 @@ description: See various tools that can help you debug your Ibexa DXP installati
6
6
7
7
## Cache clearing
8
8
9
-
### Clearing file cache using the Symfony cache:clearcommand
9
+
[[= product_name =]] contains multiple layer of caching that you can clear independently from each other:
10
10
11
-
Symfony provides a command for clearing cache.
12
-
It deletes all file-based caches, which mainly consist of a Twig template, a [service container](php_api.md#service-container), and the Symfony route cache, but also everything else stored in the cache folder.
13
-
Out of the box on a single-server setup this includes Content cache.
For further information on the command's use, see its help text:
15
+
### Clear system cache
16
+
17
+
[System cache]([[= symfony_doc =]]/cache.html#system-cache-and-application-cache) is separate for every [Symfony environment](environments.md) and stores information derivable from source code like compiled container, routes, or optimized classes.
18
+
19
+
To clear the system cache, execute the `cache:clear` command on [every web server](clustering.md) running [[= product_name =]].
20
+
21
+
To specify an environment, pass it by using either the `--env` option or the `APP_ENV` variable.
22
+
Both the examples below clear the system cache for the `prod` environment:
23
+
24
+
-`APP_ENV=prod php bin/console cache:clear`
25
+
-`php bin/console cache:clear --env=prod`
26
+
27
+
When neither the `--env` option nor the `APP_ENV` variable is set, `cache:clear` clears the system cache for the `dev` environment by default.
28
+
29
+
Don't run `cache:clear` as root as it can lead to issues with file ownership.
30
+
31
+
!!! caution "Symfony 7.4 behavior change"
32
+
33
+
Starting with Symfony 7.4, running `php bin/console cache:clear` or `rm -rf var/cache/*` clears only the system cache, even when you use a filesystem-based cache pool for [persistence cache](#clear-persistence-cache).
34
+
You must always clear the persistence cache separately.
35
+
36
+
#### Clearing system cache manually
37
+
38
+
During development, you can clear the system cache manually by running:
16
39
17
40
```bash
18
-
php bin/console --env=prod cache:clear -h
41
+
rm -rf var/cache/*
19
42
```
20
43
21
-
!!! note
44
+
!!! caution "Don't clear system cache manually on production"
22
45
23
-
If you don't specify an environment, by default `cache:clear` clears the cache for the `dev` environment.
24
-
If you want to clear it for `prod` you need to use the `--env=prod` option.
46
+
Manually clearing the system cache doesn't warm up the cache, resulting in a significant performance drop on the first request.
47
+
To avoid this, you must not clear the cache manually in a production environment.
25
48
26
-
!!! caution "Clustering"
49
+
### Clear persistence cache
27
50
28
-
In [clustering](clustering.md) setup (with several web servers), the command to clear file cache needs to be executed on every web server.
51
+
[Persistence cache](persistence_cache.md) stores information about application data.
52
+
53
+
To clear the persistence cache, you must run:
54
+
55
+
```bash
56
+
php bin/console cache:pool:clear <cache-pool>
57
+
```
58
+
59
+
The default cache pool is named `cache.tagaware.filesystem`.
60
+
The default cache pool when running Redis or Valkey is named `cache.redis`.
61
+
If you customized the persistence cache configuration, the name of your cache pool might be different.
62
+
63
+
#### Clearing persistence cache manually
64
+
65
+
During development, when using a filesystem-based cache pool, you can clear the application cache by running:
66
+
67
+
```bash
68
+
rm -rf var/share/*
69
+
```
29
70
30
-
### Clearing content cache on a cluster setup
71
+
### Clear HTTP cache
31
72
32
-
For a [cluster](clustering.md) setup, the content cache ([HTTP cache](http_cache.md) and [Persistence cache](persistence_cache.md)) must be set up to be shared among the servers.
33
-
While all relevant cache is cleared for you on repository changes when using the APIs, there might be times where you need to clear cache manually:
73
+
[HTTP cache](http_cache.md) uses reverse proxies like Varnish or Fastly to store application responses controlled by [HTTP Cache headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control).
0 commit comments