How to configure Magento to use memcached

ENABLING MEMCACHED FOR MAGENTO 2

To enable Memcached for Magento 2, you must change some settings in the env.php file. To do this, follow these steps:

Step 1: Using your preferred text editor, navigate to the directory where you installed Magento, and then open the app/etc/env.php

Step 2: Locate the following section in the php file:

'session' => [

'save' => 'files'

],

Step 3: Modify this section as follows:

'session' => [    

        'save' => 'memcached',    

        'save_path' => '127.0.0.1:11211'

  ],

Step 4: Save your changes to the env.php file. Memcached is now enabled.

ENABLING MEMCACHED FOR MAGENTO 1.9 AND OLDER VERSIONS

To enable Memcached for Magento 1.9 and older versions, you need to add some settings to the local.xml file. To do this, follow these steps:

Step 1: Using your preferred text editor, navigate to the directory where you installed Magento, and then open the app/etc/local.xml

Step 2: Add the following lines just before the closing </global> tag:

<cache>

<backend>memcached</backend>

            <memcached>

                  <servers>

                      <server>

                           <host><![CDATA[127.0.0.1]]></host>

                               <port><![CDATA[11211]]></port>

          <persistent><![CDATA[1]]></persistent>

                     </server>

                              </servers>

                      <compression><![CDATA[0]]></compression>

                      <cache_dir><![CDATA[]]></cache_dir>

      <hashed_directory_level><![CDATA[]]></hashed_directory_level>

      <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>

                      <file_name_prefix><![CDATA[]]></file_name_prefix>

                        </memcached>17. </cache>

Step 3: Save your changes to the local.xml file. Memcached is now enabled.

By following these steps Memcached can be configured.

For more Magento kb, visit Webnexs Knowledge Base.

Last Update: November 1, 2018  

November 1, 2018   142   Praveen Raja  
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn