2.14.5.6. Configure Memcache in Drupal

For more details, see Memcache(d).
  1. Open the page Drupal | Memcache API and Integration and at the bottom, copy the link to the archive with the latest version of the Memcache module.
  2. Open the admin panel of the site.
  3. Go to the "Extend" section.
  4. Click "Install new module".
  5. Paste the copied link into the "Install from a URL" field.
  6. Click "Install".
  7. Wait for the installation to complete.
  8. In the "Extend" section, select "Memcache" from the list of extensions and click "Install" at the bottom of the page.
  9. At the end of the file sites/default/settings.php, add the following code:
    $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
    $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
    $conf['memcache_stampede_protection'] = TRUE;
    $conf['cache_default_class'] = 'MemCacheDrupal';
    
    // The 'cache_form' bin must be assigned to non-volatile storage.
    $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
    
    // Don't bootstrap the database when serving pages from the cache.
    $conf['page_cache_without_database'] = TRUE;
    $conf['page_cache_invoke_hooks'] = FALSE;
    $conf['memcache_servers'] = array('unix:///home/example/.system/memcache/socket' => 'default');

    In the line with the parameter memcache_servers, instead of example, specify the name of the hosting account where the site is hosted.

    //Memcache configuration
    $settings['memcache']['servers'] = ['unix:///home/example/.system/memcache/socket' => 'default'];
    $settings['memcache']['bins'] = ['default' => 'default'];
    $settings['memcache']['key_prefix'] = '';
    $settings['cache']['default'] = 'cache.backend.memcache';

    In the line with the servers parameter, instead of example, specify the name of the hosting account where the site is hosted.

  10. Check the site operation.
Content