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',
    ],
],

Where:

  • <frontend_type> – The low-level frontend cache type. Specify a class name compatible with Zend_Cache_Core.
    If omitted, Magento\Framework\Cache\Core is used.

  • <frontend_option>, <frontend_option_value> – The name and value of options the Commerce framework passes as an associative array to the frontend cache on creation.

  • <backend_type> – The low-level backend cache type. You can specify:

    • Symfony Cache (2.4.9+, recommended): Simplified names like valkey or file
    • Zend-based: Full class name compatible with Zend_Cache_Backend that implements Zend_Cache_Backend_Interface
  • <backend_option>, <backend_option_value> – The name and value of options the Commerce framework passes as an associative array to the backend cache on creation.

NOTE
For backend value formats, such as Zend-based class names versus Symfony Cache simplified names like valkey or file, see Cache backend options.
recommendation-more-help
commerce-operations-help-configuration