Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Cache tags, cache blocks and clearing caches

The caches an extension author meets: ids and tags of ezcache.php and exp:cache, what to clear after which change, cache-block in templates, and clearing an object's view cache from PHP.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-8-reference/cache-tags-and-clearing.md

On this page

Cache tags, cache blocks and clearing caches

Part 8, reference 22. Exponential caches settings, compiled templates, rendered pages and more. When a change "does not work", a cache is the usual reason. This page lists the caches by what you changed, and shows how your own code clears caches correctly.

The commands

php bin/php/ezcache.php --clear-tag=ini            # by tag: every cache with that tag
php bin/php/ezcache.php --clear-id=template,template-override
php bin/php/ezcache.php --clear-all
php bin/php/ezcache.php --list-tags
./console exp:cache status                          # every group, and the newer caches
./console exp:cache clear --tag=ini --dry-run       # what it would do

exp:cache does what the administration's cache page does, and also covers the static cache, the HTTP cache, the SQL query cache and Velocity (Cache control from the console). Add --allow-root-user when running as root, but prefer running as the web server's user.

The cache ids and their tags

From kernel/classes/ezcache.php:

IdTagsHolds
ini, global_iniiniparsed settings
active_extensionsinithe active extension list
templatetemplatecompiled templates
template-overridetemplatethe override rules' lookup
template-blocktemplate, contentoutput of cache-block
design_basetemplatethe design chain
contentcontentrendered content views
exphttpcachecontent, templatethe HTTP response cache
querycachecontent, inithe SQL query cache
graphqlcontent, inithe answers of the GraphQL API's persisted queries and the class catalogues of its schema
classid, sortkey, urlalias, content_tree_menu, state_limitations, content_languagecontentlookups about content
translation, chartransi18ntranslations
imagealiasimageimage variations
user_info_cacheuseruser and role data

What to clear after what

You changedClear
an INI file--clear-tag=ini (the tag, not --clear-id=ini, which leaves the global INI cache)
activated an extension--clear-tag=ini, then --clear-id=design_base,template-override and regenerate the autoloads
a templateusually nothing; --clear-id=template if compiled templates are cached
added a template file used by an override rule--clear-id=template-override
a stylesheet or script in a packer list--clear-id=template-block (the packed links are in cache blocks), then a hard reload
a translation--clear-tag=i18n
a class or a policy--clear-tag=content and --clear-id=user_info_cache

cache-block in templates

{cache-block keys=array( $node.node_id, $current_user.contentobject_id ) expiry=600}
    {* expensive fetches and markup *}
{/cache-block}
ParameterMeaning
keyswhat makes the content differ: the node, the user, the language. Leave nothing out, or one user sees another's block
expiryseconds before it is built again
subtree_expirythe block expires when content under that node is published
ignore_content_expirydo not expire on every publish

Never cache per-user content without the user in keys. The designer help explains the template side in detail (cache-block).

From your PHP code

When your code changes content through the kernel's functions, the kernel clears the view caches itself. When your extension changes something that affects how an object is displayed (its own table that a template reads), clear that object's caches:

<?php
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

clearContentCacheIfNeeded( $objectID, $versionNum = true, $additionalNodeList = false ) follows the site's view cache settings (which related nodes to clear). For your own file caches under var/, delete or regenerate them through the cluster file handler (eZFile, eZDir and cluster file handlers).

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x