Configure caching for remote storage
Remote storage provides a cache layer for external API calls. The caching is based on the Flysystem caching solution, which provides cache adapters. Remote storage includes the following cache types:
- Memory cache—Memory cache is enabled by default and provides per-request cache.
- Redis cache—Redis cache is a persistent cache that is stored in Redis and requires an active Redis service with additional configuration.
Set up persistent Redis cache
To use Redis cache with predis/predis extension:
-
Add the
predis/predis
extension to therequire
section of yourcomposer.json
file.1
composer require predis/predis
-
Use the following example to add a configuration to the
app/etc/env.php
file.1 2 3 4 5 6 7 8 9 10 11 12 13
[ 'remote_storage' => [ # Remote storage configuration section 'cache' => [ 'adapter' => 'predis', 'config' => [ 'scheme' => 'tcp', # Required scheme 'host' => 'redis.internal', # Required hostname of Redis service 'port' => 6379 # Required port of Redis service ] ] ] ];