Cache backend options and storage reference
app/etc/env.php configuration.ece-tools package generates the resulting app/etc/env.php configuration during deployment based on the deploy variable configuration in .magento.env.yaml. You do not edit the env.php file. See Best Practices for Valkey and Redis Service Configuration and Deploy variables.The Commerce application uses a low-level cache frontend and backend to provide access to cache storage. Commerce supports several caching backends and strategies, each suited to different use cases. This page describes the available backends and how they differ.
Backend cache options
The following table summarizes the available backend caches:
var/cache/. No configuration required.Cache backend and L2 implementations implementation-approaches
Commerce supports direct cache backends and L2 caching. A direct backend selects cache storage. L2 caching adds a local cache layer in front of remote storage.
Direct cache backends
The following table summarizes cache backend configuration values for <Commerce-install-dir>/app/etc/env.php. It does not enable L2 caching.
Magento\Framework\Cache\Backend\RedisMagento\Framework\Cache\Backend\ValkeyfilevalkeyFor exact patch-level support, see the System Requirements.
[!TAB Zend-based cache (2.4.8 and earlier)]
Backend examples
For on-premises deployments, the following examples configure direct cache backends in <Commerce-install-dir>/app/etc/env.php. They do not enable L2 caching. Do not use these examples for Adobe Commerce on Cloud deployments, which use the ece-tools package to generate the resulting app/etc/env.php configuration during deployment.
Use the full Redis class name only on releases where Redis is supported:
| code language-php?start_inline=1 |
|---|
|
| code language-php?start_inline=1 |
|---|
|
L2 caching
L2 (two-level) caching adds a local cache layer on each web node in front of shared remote cache storage, reducing network traffic between Commerce and the remote cache. For implementation options, version support, and configuration steps, see L2 cache configuration.
For Cloud projects, configure L2 caching through the deployment variables described in Deploy variables.