General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Using the internal cache service allows you to use a interface  and an interface and to not have to care about if whether the system has been configured to place the cache in Memcached or on File system. And as eZ Platform requires that instances uses use a cluster-aware cache in Cluster setup, you can safely assume your cache is shared (and invalidated) across all web servers.

Warning
titleInterface will change in the future

Current implementation uses a caching library called Stash, via Stash-bundleStashBundle. We plan to move to a PSR-6 compatible cache service cable capable of supporting cache Tagging and multi get/set in the future, when that happens the interface of the cache service will change!

Note
titleUse unique vendor prefix for Cache key!

When reusing the cache service within your own code, it is very important to not conflict with the cache keys used by others, hence . That is why the example of usage below starts with a unique "myApp" key for . For the namespace of your own cache, you must do the same! So never clear cache using the cache service without your key specified, otherwise you'll clear all cache.

...

Via Dependency injection

In your symfony Symfony services configuration you can simply define that you require the "cache" service in your configuration like so:

...

Like any other service, it is also possible to get the "cache" service via container as well like so:

Code Block
languagephp
titlegetting Getting the cache service in phpPHP
/** @var $cacheService \Tedivm\StashBundle\Service\CacheService */
$cacheService = $container->get('ezpublish.cache_pool');

...

Clearing Persistence cache

Persistence cache uses a separate Cache Pool decorator which by design prefixes cache keys with "ez_spi", clearing . Clearing persistence cache can thus be done in the following way:

...