Clearing the view cache
The view cache is cleared automatically when content is published, and can be cleared by hand in the administration and from a shell.
What publishing clears
When a version of an object is published (also the first one), the view cache is cleared for:
- all locations (nodes) of the object;
- their parent nodes;
- the nodes of objects with the same keywords, when the object has a Keywords attribute (limited by viewcache.ini [ViewCacheSettings] KeywordNodesCacheClearLimit);
- the nodes of related objects, as viewcache.ini [ViewCacheSettings] ClearRelationTypes[] says: as shipped, objects related on object level (common), objects that relate to this one on object level (reverse_common) and objects that embed it (reverse_embedded).
The other values of ClearRelationTypes[] are embedded, linked, attribute, reverse_linked and reverse_attribute (relations through Object relation attributes). The smart view cache cleaning adds rules of your own.
The cache is cleared for the same nodes on every related siteaccess ([SiteAccessSettings] RelatedSiteAccessList[], see Configuring the view cache). When more than site.ini [ContentSettings] CacheThreshold nodes (250) would be cleared one by one, all view caches are expired at once instead, and the log says "Expiring all view cache".
In the administration
In the full view of a node, open the menu of the node's class icon (in the title of the view, or in the content tree) and choose:
- Delete view cache: the view cache of that node;
- Delete view cache from here: of that node and every node below it.
The whole content view cache, and every other cache, is cleared under Setup > Caches (/setup/cache, policy setup/managecache): tick Content view cache (id content) and press Clear selected, or Clear content caches... for every cache with the tag content.
Setup > Caches (/setup/cache).
From a shell
bin/php/ezcontentcache.php (also ./console exp:ezcontentcache) clears the view cache of nodes or subtrees, given by node ID or URL alias, several separated by commas:
# node 46 and what publishing it would clear (its locations, parents, related nodes ...) php bin/php/ezcontentcache.php --clear-node=46 php bin/php/ezcontentcache.php --clear-node=/company/about php bin/php/ezcontentcache.php --clear-node=46,59,63 # a node and everything below it php bin/php/ezcontentcache.php --clear-subtree=/company/news php bin/php/ezcontentcache.php --clear-subtree=/company/news,/partners
All content view caches at once:
php bin/php/ezcache.php --clear-id=content ./console exp:cache clear --id=content --dry-run # what would be cleared, with sizes
Under Exponential Velocity, also clear its response cache afterwards (./console exp:velocity cache clear --apply), or wait a few seconds: it may still answer with a page made before the clear.
Expired cache files stay on disk until the same page is rendered again. The cronjob part cache_cleanup (php runcronjobs.php -s <siteaccess> cache_cleanup) removes expired files and files older than cronjob.ini [CacheCleanupSettings] MaxAge.
More
Contributors
- Svitlana Shatokhina
- Andrea Melo Maintainer
- Geir Arne Waaler Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment