Install Memcached for Drupal 8


By installing Memcached on your server, you can speed up the load time for your web site pages.

From the official web site: "Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering."

Install Memcached and the php5-memcache plug-in and restart Apache:

sudo apt-get install memcached php5-memcache
sudo service apache2 restart

If you plan on using Memcached on more than one Drupal installation, you need to define a prefix_key. To avoid conflict at the cache generation, you currently (October 2016) need to use the dev-version. See this issue:

drush dl memcache --dev
drush en -y memcache

Add this at end of your settings.php (replace "[UNIQUE_IDENTIFIER]" with your own value)

### Memcache
$settings['memcache']['servers'] = ['' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '[UNIQUE_IDENTIFIER]';
$settings['cache']['default'] = 'cache.backend.memcache';

For a nice Admin interface, use phpMemAdmin, clone it into your web directory ,and install it with Composer:

git clone
cd phpMemAdmin/
composer install

Access the admin interface here (default username and password is "admin" and "pass"):

Increase the amount of memory, by editing /etc/memcached.conf and restarting Memcached.
Change "-m 64" to for example "-m 2048".

sudo service memcached restart