eZ Community » Learn » eZ Publish » eZ Publish Cache In Details:...

eZ Publish Cache In Details: expiry.php and ezcache.php command

Wednesday 05 June 2013 2:46:43 pm

  • Currently 3 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Add their own ID and Tags in an extension

When installing or developping a new extension, or following a kernel update, it is possible to obtain new cache expiry identifiers, related to this extension or kernel update. The new idientifiers are declared outside the ezcache.php file (which potentially could be done for all identifiers) in the settings/site.ini configuration file (for the kernel) or extension/{extension_name}/settings/site.ini.append.php
On the version of eZ Publish currently used for this article (eZ 2012.x), we can find two illustration statements outside the ezcache.php file:

  • The cache expiry identifiers for the REST API (rest and rest-routes), declared in settings/site.ini, because the REST API is not an extension but a kernel evolution
  • The cache expiry identifiers for eZJSCore (ezjscore-packer), declared in¬†extension/ezjscore/settings/site.ini.append.php

The site.ini file thus produces both a documentation and a usage example of the parameters:

[Cache]
# Array with cache items to extend ezcache
CacheItems[]
 
# Example of use:
#CacheItems[]=custom
#
#[Cache_custom]
#
# [optional] Name of the cache item, key (custom) is used camel-cased if not set
#name=Custom cache
# [optional] Id of cache item, to be used from command line, key (custom) is used if not set
#id=custom
# [optional] If cache item should be cleared using cluster instead of plain file handler, def: false
#isClustered=true
# [optional] tags that will trigger clearing of this item, default: empty array
#tags[]=content
#tags[]=custom
# [optional] If cache uses eZExpiryHandler, then this is the key to get expiry time
#expiryKey=global-custom-cache
# [optional] (bool) If this cache is enabled or not, default: true
#enabled=false
# [optional] Path where cache is stored, either directory or file if class/purgeClass
# variables are unset, relative to current cache directory is assumed
#path=custom_cache.php
# [optional] custom cache clear function "<class>::clearCache()" to be called
#class=eZSomeClassName
# [optional] custom cache purge function "<class>::purgeCache()" to be called
#purgeClass=eZSomeClassName
 
CacheItems[]=rest
CacheItems[]=restRoutes
 
[Cache_rest]
name=REST Application cache
id=rest
tags[]=content
tags[]=rest
path=rest
isClustered=true
 
[Cache_restRoutes]
name=REST Routes memory cache
id=rest-routes
tags[]=rest
class=ezpRestRoutesCacheClear
purgeClass=ezpRestRoutesCacheClear
 

The extension/ezjscore/settings/site.ini.append.php file provides an example of usage in an extension context:

# Cache item entry (for eZ Publish 4.3 and up)
[Cache]
CacheItems[]=ezjscore
 
[Cache_ezjscore]
name=eZJSCore Public Packer cache
id=ezjscore-packer
tags[]=content
tags[]=template
path=public
isClustered=true

 

 

 
36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from