Skip to content

Described clearing caches in more detail#3289

Open
mnocon wants to merge 6 commits into
5.0from
cache-clearing
Open

Described clearing caches in more detail#3289
mnocon wants to merge 6 commits into
5.0from
cache-clearing

Conversation

@mnocon

@mnocon mnocon commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Target: 4.6, 5.0, 6.0

As reported on Slack:

Hello,

https://doc.ibexa.co/en/5.0/infrastructure_and_maintenance/support_and_maintenance_faq/#how-to-clear-the-cache-properly
should cover the changes mentioned in https://doc.ibexa.co/en/5.0/update_and_migration/from_5.0/update_from_5.0/#update-symfony-from-73-to-74  imho.
(so basically saying that persistence cache needs always to be cleared separately - even when using filesystem)

This PR clarifies the types of caches and how to clear them.

  1. I've used the terminology from Symfony for system and application caches:
  1. Added a section for clearing HTTP cache as well

In addition, I've cleaned up outdated content in the Persistence Cache article - mentioned in comments.

The goal is to have a single "how to clear caches from CLI" article we can use.

@github-actions

Copy link
Copy Markdown

@mnocon mnocon marked this pull request as ready for review July 13, 2026 14:00
@mnocon mnocon requested a review from reithor July 13, 2026 14:04
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 760091
🔗 Unique 15034
✅ Successful 7276
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 752815
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Full Github Actions output

### Using the cache service

Example usage of the cache service:

``` php
use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrote this to avoid getting a service from the container directly - that's not recommended anymore

If you have customized the persistence cache configuration, the name of your cache pool might be different.

Persistence cache prefixes it's cache using "ibx-". Clearing persistence cache can thus be done in the following ways:
Persistence cache uses the `ibx-` prefix, declared as a container parameter called `ibexa.core.persistence.cache.tag_prefix`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/ibexa/core/blob/6.0/src/lib/Resources/settings/storage_engines/cache.yml#L13

The part about clearing the cache with the command was out of place here, it's about API usage.

Added a link for people searching how to clear the cache manually.

Manual cache clearing should be executed with caution, as it doesn't warm up the cache.
It results in a significant performance drop on first request, so it shouldn't be called on a production environment.
Besides, it could lead to issues with file ownership after running `cache:clear` as a root.
See [Cache clearing](devops.md#cache-clearing) for information how to clear system, application, and HTTP caches.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to have this info duplicated in two places.


## Web Debug Toolbar

As of [[= product_name =]] v4.5, the [Symfony Web Debug Toolbar]([[= symfony_doc =]]/profiler.html) is no longer installed by default.
To install it, run the following command:

```bash
composer require symfony/debug-pack
composer require --dev symfony/debug-pack

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--dev was missing, and it's crucial!


### Clearing content cache on a cluster setup
### Clear HTTP cache

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a dedicated HTTP cache section to cover all types of caches.

use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

// Getting the cache service in PHP

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ibexa.cache_pool is a private service (Public: no) so it's not possible to retrieve it from the container anymore

~/Desktop/Sites/v5 main +1 !174 ?19 ❯ php bin/console debug:container ibexa.cache_pool                                                                                                               24.4.0 13:21:18

 // This service is a private alias for the service
 // Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter

Information for Service "Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter"
================================================================================================

 Internal proxy adapter invalidating our isolated in-memory cache, and defer shared pool changes during transactions.

 ---------------- ---------------------------------------------------------------------------------------------------------------------------------
  Option           Value
 ---------------- ---------------------------------------------------------------------------------------------------------------------------------
  Service ID       Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter
  Class            Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter
  Tags             container.decorator (id: ibexa.cache_pool, inner: Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter.inner)
  Public           no
  Synthetic        no
  Lazy             yes
  Shared           yes
  Abstract         no
  Autowired        no
  Autoconfigured   no

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*.
In other words, there should be no need to manually clear the cache like it was frequently the case with eZ Publish 4.x.
This is possible thanks to an interface that follows CRUD (Create Read Update Delete) operations per domain.
With the persistence cache, like with the HTTP cache, [[= product_name =]] follows the principles of transparent caching.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed an outdated eZ Publish 4.x mention 🙈

```

The default cache pool is named `cache.tagaware.filesystem`.
The default cache pool when running Redis or Valkey is named `cache.redis`.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mnocon mnocon requested a review from a team July 13, 2026 14:18
php bin/console --env=prod cache:clear
```

If you don't specify an environment, by default `cache:clear` clears the cache for the `dev` environment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely correct AFAIR. If you set APP_ENV=prod, by default it should clear prod env. If you ssh into an e.g., Upsun instance, that variable will be set by default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://youtu.be/hou0lU8WMgo 😄

Thanks, nice catch! Clarified (hopefully) in 253fa6b

@julitafalcondusza julitafalcondusza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small remark.


The default cache pool is named `cache.tagaware.filesystem`.
The default cache pool when running Redis or Valkey is named `cache.redis`.
If you have customized the persistence cache configuration, the name of your cache pool might be different.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid Present Perfect:

Suggested change
If you have customized the persistence cache configuration, the name of your cache pool might be different.
If you customized the persistence cache configuration, the name of your cache pool might be different.

or

Suggested change
If you have customized the persistence cache configuration, the name of your cache pool might be different.
If your persistence cache configuration is customized, the name of your cache pool might be different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants