Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »


Introduction

Tech Note

Current implementation uses a caching library called Stash, via Stash-bundle. If this changes, then the configuration format will most likely change as well. Stash supports the following cache handlers: FileSystemMemcache, APC, Sqlite, XCache and BlackHole.

Cache service

The cache system is exposed as a "cache" service, and can be reused by any other service as described on the Persistence cache page.

Configuration

During Setup wizard and manually using ezpublish:configure console command a default configuration is generated currently using FileSystem, using %kernel.cache_dir%/stash to store cache files. It falls back to BlackHole, a non caching cache handler.

The configuration is placed in ezpublish/config/ezpublish.yml, and looks like:

Default ezpublish.yml

The default settings used during setup wizard as found in ezpublish/config/ezpublish_setup.yml:

ezpublish_setup.yml

This setting works across all installs and just caches objects within the same request thanks to the inMemory: true setting.

If you want to change to another handler, see below for what kind of settings you have available.

Note for multiple sites installation

As cache configuration is global to the application, it's currently not possible to have different cache configuration by siteaccess. As such, when having multiple websites using different content repositories, you must only use the BlackHole handler with inMemory caching:

This will result to the same persistence cache strategy as in eZ Publish 4.x.

Note for "inMemory" cache with long running scripts

Use of inMemory caching with BlackHole or any other cache handler should not be used for long running scripts as it will over time return stale data (inMemory cache is not shared across requests/processes, so invalidation does not happen)!

Stash handlers configuration

General settings

To check which cache settings are available for your installation, run the following command in your terminal :

FileSystem

This cache handler is using local filesystem, by default the Symfony cache folder, as this is per server, it does not support multi server (cluster) setups!

We strongly discourage you from storing cache files on NFS, as it defeats the purpose of the cache: speed


Available settings

pathThe path where the cache is placed, default is %kernel.cache_dir%/stash, effectively ezpublish/cache/<env>/stash
dirSplitNumber of times the cache key should be split up to avoid having to many files in each folder, default is 2.
filePermissionsThe permissions of the cache file, default is 0660.
dirPermissionsThe permission of the cache file directories (see dirSplit), default is 0770.
memKeyLimitLimit on how many key to path entries are kept in memory during execution at a time to avoid having to recalculate the path on key lookups, default 200.

APC

This cache handler is using shard memory using APC's user cache feature, as this is per server, it does not support multi server (cluster) setups, unless you use PHP-FPM on a dedicated server (this way, user cache can be shared among all the workers in one pool).

Limitation

As APC user cache is not shared between processes, it is not possible to clear the user cache from CLI, even if you set apc.enable_cli to On.
Hence publishing content from a command line script won't let you properly clear SPI cache.

Please also note that the default value for apc.shm_size is 128MB. However, 256MB is recommended for APC to work properly. For more details please refer to the APC configuration manual.

 

Available settings

ttlThe time to live of the cache in seconds, default set to 500 (8.3 minutes)
namespaceA namespace to prefix cache keys with to avoid key conflicts with other eZ Publish sites on same eZ Publish installation, default is null.

Memcache

This cache handler is using Memcached, a distributed caching solution, this is the only supported cache solution for multi server (cluster) setups!

Note

Stash supports both the php Memcache and Memcached extensions. However Memcached is recommended as it is much more advanced and supports all settings below.

If you have both extensions installed, Stash will automatically choose Memcached.

servers

Array of Memcached servers, with host/IP, port and weight

server: Host or IP of your Memcached server
port: Port where Memcached is listening to (defaults to 11211)
weight: Weight of the server, when using several Memcached servers

prefix_keyA namespace to prefix cache keys with to avoid key conflicts with other eZ Publish sites on same eZ Publish installation (default is an empty string).
Must be the same on all server with the same installation. See Memcached option.
compressiondefault true. See Memcached option.
libketama_compatibledefault false. See Memcached option
buffer_writesdefault false. See Memcached option 
binary_protocoldefault false. See Memcached option 
no_blockdefault false. See Memcached option 
tcp_nodelaydefault false. See Memcached option 
connection_timeoutdefault 1000. See Memcached option 
retry_timeoutdefault 0. See Memcached option 
send_timeoutdefault 0. See Memcached option 
recv_timeoutdefault 0. See Memcached option 
poll_timeoutdefault 1000. See Memcached option 
cache_lookupsdefault false. See Memcached option 
server_failure_limitdefault 0. See Memcached option 

For in-depth information on the settings, see: http://php.net/Memcached

When using Memcache handler, it's strongly recommended to also use inMemory cache (see example below).
This will help reducing network traffic between your webserver and your Memcached server.

Example with Memcache

  • No labels