The following steps walk through associating cache frontend with a cache type.
The Commerce application has a
default cache frontend that you can use for any cache type. This section discusses how to optionally define a cache frontend with a different name, which is preferable if you expect to customize your frontend.
To use the
default cache type, you do not need to modify
env.php at all; you modify Commerce’s global
di.xml. See Low-level cache options.
You must specify a custom cache frontend either
app/etc/env.php or Commerce’s global
The following example shows how to define it in the
env.php file, which overrides the
'cache' => [ 'frontend' => [ '<unique frontend id>' => [ <cache options> ], ], 'type' => [ <cache type 1> => [ 'frontend' => '<unique frontend id>' ], ], 'type' => [ <cache type 2> => [ 'frontend' => '<unique frontend id>' ], ], ],
<unique frontend id> is a unique name to identify your frontend and
<cache options> are options discussed in the topics specific to each type of caching (database, Redis, and so on).
You can specify frontend and backend cache configuration options in
di.xml. This task is optional.
'frontend' => <frontend_type>, 'frontend_options' => [ <frontend_option> => <frontend_option_value>, ... ], 'backend' => <backend_type>, 'backend_options' => [ <backend_option> => <backend_option_value>, ... ],
<frontend_type> is the low-level frontend cache type. Specify the name of a class that is compatible with
If you omit
<frontend_type>, Magento\Framework\Cache\Core is used.
<frontend_option_value> are the name and value of options the Commerce framework passes as an associative array to the frontend cache upon its creation.
<backend_type> is the low-level backend cache type. Specify the name of a class that is compatible with
Zend_Cache_Backend and that implements
<backend_option_value> are the name and value of options the Commerce framework passes as an associative array to backend cache upon its creation.
See the Laminas documentation for the latest Zend information.