Follow this tutorial to easily implement Memcached in Magento 2:
- First make sure you Activate Memcached caching in your control panel. You will need those IP and port number
- Check the PHP version. PHP 5.6 or earlier would work. PHP 7 will not work with this tutorial.
- Edit /app/etc/env.php:
- Using ssh, go to the root of your Magento installation. Under the app/etc/ directory locate “env.php”. This file you need to edit.
- Locate this code string
'session' => array ( 'save' => 'files', ),
- Edit that to match the following:
'session' => array ( 'save' => 'memcache', 'save_path' => 'tcp://250.250.250.1:1000' ),
In this line you have to replace the IP address and port number with the Memcached details that you get in your control panel.
- Test if it works. Go to the root of Magento installation and clear the contents of the cache:
rm -rf var/cache/* var/page_cache/* var/session/*
- Make a final test by loading your site in your browser. If your website shows up, the configuration is correct.
583