Skip to content

Instantly share code, notes, and snippets.

@hn-support
Last active March 20, 2017 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hn-support/16d96442c1fc3228bcede280790171b6 to your computer and use it in GitHub Desktop.
Save hn-support/16d96442c1fc3228bcede280790171b6 to your computer and use it in GitHub Desktop.
Setup redis page cache for magento2
'cache' => array (
'frontend' => array (
'default' => array (
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => array (
'server' => '127.0.0.1',
'port' => '6379',
),
),
// Start of snippet
'page_cache' => array (
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => array (
'server' => '127.0.0.1',
'port' => '6379',
'database' => '1',
'compress_data' => '0',
),
),
// End of snippet
),
),
@mikebranderhorst
Copy link

mikebranderhorst commented Feb 20, 2017

Add missing array(
Indent and comma like default
page_cache should be a child of frontend
http://devdocs.magento.com/guides/v2.1/config-guide/redis/redis-pg-cache.html

  'cache' => 
  array (
    'frontend' => 
    array (
      'default' =>
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' =>
        array (
          'server' => '127.0.0.1',
          'port' => '6379',
        ),
      ),
      // Start of snippet
      'page_cache' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'port' => '6379',
          'database' => '1',
          'compress_data' => '0',
        ),
      ),
      // End of snippet
    ),
  ),

or with 4 spaces:

    'cache' => array (
        'frontend' => array (
            'default' => array (
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => array (
                    'server' => '127.0.0.1',
                    'port' => '6379',
                ),
            ),
            // Start of snippet
            'page_cache' => array (
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => array (
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'database' => '1',
                    'compress_data' => '0',
                ),
            ),
            // End of snippet
        ),
    ),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment