Here are 2 steps for you know How to use Memcache in Magento 2 in Ubuntu:
- Step 1 :To install and configure memcached on Ubuntu
- Step 2 : To configure Magento to use memcache
Step 1 :To install and configure memcached on Ubuntu
1.As a user with root privileges, enter the following command:
apt-get -y update
apt-get -y install php5-memcache memcached
2.Change the memcached configuration setting for CACHESIZE and -l:
- Open /etc/memcached.conf in a text editor.
- Locate the -m parameter and change its value to at least 1GB
- Locate the -l parameter and change its value to 127.0.0.1 or localhost
- Save your changes to memcached.conf and exit the text editor.
- Restart memcached.
- service memcached restart
3.Restart your web server: service apache2 restart
Step 2 : To configure Magento to use memcache
1.Open <your Magento install dir>/app/etc/env.php
2.Locate the following:
1234567891011'session' =>array ('save' => 'files',),Change it as follows:'session' =>array ('save' => 'memcache','save_path' => 'tcp://<memcache ip or host>:<memcache port>'),
To verify memcached works with Magento:
- Delete the contents of the following directories under your Magento installation directory:
- rm -rf var/cache/* var/page_cache/* var/session/*
- Go to any page on the storefront.
- Log in to the Magento Admin and browse to several pages.
- If no errors display, congratulations! memcached is working
Ready to foster your knowledge
Is your site still a mess and Magento extensions are not enough to save your site? Save your site with Magento Web Development Services now