ibexa

Path

ez publish / technical manual / 3.8 / features / view caching / clearing the view cache


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

Clearing the view cache

When a new version (also the first version) of an object is published, the system will automatically clear the view cache for the following items:

  • All published nodes of the object
  • The parent nodes
  • Nodes of related and reverse related objects that have relations at the object level (this is controlled by the "ClearRelationTypes" configuration setting)
  • Nodes of other objects that have the same keyword as the object (if the "Keywords" datatype is used by at least one of the attributes).

This default behavior can be extended by configuring the smart viewcache cleaning system.

Please note that clearing the view caches for a set of nodes within a certain siteaccess means that caches for the same nodes will also be cleared on all the related siteaccesses.

Using the administration interface

The administration interface allows you to clear the view cache for a node that is being viewed:

  1. Navigate to the node that you wish to clear the view cache for. In other words, make sure that the target node is being displayed.
  2. In the title bar of the preview window, click on an icon that indicates the node type and select the "Delete the view cache" item from the popup menu (shown in the following screenshot):
    Clearing the view cache using popup menu

    Clearing the view cache using popup menu.

You can also clear the view cache for the entire subtree (together with the node itself) by selecting the "Delete the view cache from here" item from the popup menu.

Using the script

It is possible to clear the view cache for a specific node or subtree using the "ezcontentcache.php" script located in the "bin/php" directory of the eZ Publish installation. The following examples demonstrate how this can be done.

Example 1

Let's say that node 46 is the company about page (http://www.mysite.com/company/about) and you have made some changes to a custom template that is used for this node. If view caching is enabled, your changes will not be seen until you clear the view cache for node 46:

  1. Navigate into the eZ Publish directory.
  2. Run the script using the following command:
    ./bin/php/ezcontentcache.php --clear-node=46
    
    or
    ./bin/php/ezcontentcache.php --clear-node=/company/about
    

This will clear the view cache for node 46 (and for other locations of the same object, if any), their parent nodes, nodes of objects containing the same keywords, nodes of related and reverse related objects that have relations at the object level.
If you need to clear view caches for several nodes, specify their ID numbers (or nice URLs) separated by commas:

./bin/php/ezcontentcache.php --clear-node=46,59,63

The script will clear all content caches related to each of the given nodes.

Example 2

Let's say that node 72 is the company news folder (http://www.mysite.com/company/news) containing a lot of news articles. To clear the view caches for this folder and the nodes below it, do the following:

  1. Navigate into the eZ Publish directory.
  2. Run the script using the following command:
    ./bin/php/ezcontentcache.php --clear-subtree=72
    
    or
    ./bin/php/ezcontentcache.php --clear-subtree=/company/news
    

If you need to clear view caches for several subtrees, specify the nice URLs (or ID numbers) of their root nodes separated by commas:

./bin/php/ezcontentcache.php --clear-subtree=/company/news,/partners

The script will then clear view caches for the specified subtrees.

Svitlana Shatokhina (23/10/2006 9:30 am)

Svitlana Shatokhina (07/05/2007 11:08 am)

Balazs Halasy, Svitlana Shatokhina


Comments

There are no comments.