This feature is an Incubator, and as such might change from minor release to the next depending on: symfony/symfony#30370
Contains a set of optimized TagAwareAdapters that cuts number of cache lookups down by half compared to usage of Symfony's TagAwareAdapter. In short, for Filesystem symlinks for tags are used, and for Redis a Set is used to keep track of ids connected to a tag, and instead of tag lookups to find expiry info on each request this info is used to do it on-demand when calling invalidation buy tags. See Adapters for further details.
It also backports Marshaller
feature from Symfony 4 in order to support serialization with igbinary.
The MarshallerInterface
and DefaultMarshaller
class is taken from the following revision: d2098d7
See: https://github.com/symfony/symfony/commits/master/src/Symfony/Component/Cache/Marshaller
- Symfony 3.4, PHP 7.1+
- For usage eZ Platform v2:
ezsystems/ezpublish-kernel
v7.5 or higher. - For
RedisTagAwareAdapter
usage:
After installing the bundle, you have to configure proper services in order to use this.
Below are examples on how to configure these adapters with eZ Platform 2.5.x
Enabled by default on eZ Platform 2.5+, this is done by means of a new cache adapter service: https://github.com/ezsystems/ezplatform/blob/v2.5.8/app/config/cache_pool/cache.tagaware.filesystem.yml
By default CACHE_POOL
environment is set to cache.tagaware.filesystem
to use it.
If you change to this adapter, clear cache and restart web server. You can verify if the adapter is in use on the Symfony web debug toolbar.
Add a service for redis cache. On eZ Platform 2.5 or higher, it is provided by default in app/config/cache_pool/cache.redis.yml
.
Once that is done you can enable the handler, for instance by setting the following environment variable for PHP:
export CACHE_POOL="cache.redis"
If you don't have redis, for testing you can use:
- Run:
docker run --name my-redis -p 6379:6379 -d redis
. - Stop + Remove:
docker rm -f my-redis
. - Debug:
printf "PING\r\n" | nc localhost 6379
, should return+PONG
.docker exec -ti my-redis redis-cli INFO
(see redis.io/commands for more)
If you change to this adapter, clear cache and restart web server. You can verify if the adapter is in use on the Symfony web debug toolbar.