Configure cache frontends and types

A cache frontend connects Commerce cache types to cache storage. You can define multiple frontends and assign specific cache types to each frontend.

Use the following relationship to determine where a cache type stores its data:

cache type → cache frontend → cache backend

For an overview of the Commerce caching architecture, see Caching overview and configuration options.

NOTE
For Adobe Commerce on cloud infrastructure, use the Cloud deployment configuration described in the Cloud guide. Do not edit app/etc/env.php directly. Deployment tooling generates this file and can overwrite manual changes.

Use the default frontend

Commerce provides a default frontend that can be used by all cache types.

In most cases, you do not need to define a custom frontend. If all cache types can use the same backend and backend options, use the default frontend and configure its backend. See Cache backend options for backend-specific configuration.

For Adobe Commerce versions before 2.4.9, the default frontend uses the legacy Zend-based cache implementation. The Magento\Framework\Cache\Core frontend extends Zend_Cache_Core. Adobe Commerce 2.4.9 and later use the modern Symfony implementation. See Cache backend options for version-specific guidance.

Define a custom frontend

Use a custom cache frontend when one or more cache types need backend settings that differ from those of the default frontend.

For on-premises deployments, define the frontend in app/etc/env.php. Then assign one or more cache types to it:

'cache' => [
    'frontend' => [
        '<frontend-id>' => [
            'backend' => '<backend-type>',
            'backend_options' => [
                // Backend-specific options
            ],
        ],
    ],
    'type' => [
        '<cache-type-id>' => [
            'frontend' => '<frontend-id>',
        ],
    ],
],

Where:

  • <frontend-id> is the unique identifier for the frontend, such as default or page_cache.
  • <backend-type> identifies the backend used by the frontend. The supported value depends on the Adobe Commerce release and selected backend.
  • backend_options contains options for the selected backend.
  • <cache-type-id> is a Commerce cache type, such as config, layout, block_html, or full_page.

For backend types, supported options, and release-specific configuration examples, see Cache backend options.

Assign a cache type to a frontend

The type configuration maps a cache type to a frontend:

'type' => [
    'full_page' => [
        'frontend' => 'page_cache',
    ],
],

In this example, Commerce assigns the full_page cache type to the page_cache frontend. The frontend determines which backend configuration stores that cache type.

NOTE
The full_page key represents a Commerce application cache type. HTTP full-page caching through Varnish or Fastly is a separate caching layer. See Caching overview and configuration options.
recommendation-more-help
commerce-operations-help-configuration