Path

ezpublish / documentation / ez publish / technical manual / 4.x / features / view caching / clearing the view cache


Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

Clearing the view cache

This part of the 4.x documentation is for eZ Publish 4.0, only reference section is common for all eZ Publish 4.x versions as well as eZ Publish 5.x "LegacyStack", please select the version you are using for the most up to date documentation!

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 other objects that have the same keyword as the object (if the "Keywords" datatype is used by at least one of the attributes).

In addition, the view caches of the following nodes will also be cleared:

  • Nodes of related and reverse related objects that have relations of the "common" type
  • Nodes of reverse related objects that have relations of the "XML embedded" type

This is controlled by the "ClearRelationTypes" configuration setting.

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

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 pop-up 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 pop-up 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 of the "common" type and nodes of reverse related objects that have relations of the "XML embedded" type. 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)

Ricardo Correia (17/04/2013 3:15 pm)

Balazs Halasy, Svitlana Shatokhina, Geir Arne Waaler, Ricardo Correia


Comments

There are no comments.