Skip to content Skip to navigation

Memcache on the WWW servers

Posted by: 
Topics: 

Drupal 6

  1. In php.ini set memcache.hash_strategy="consistent".
  2. Put your site into offline mode.
  3. Download and install the memcache module.
  4. If you have previously been running the memcache module, run update.php.
  5. Edit settings.php to make memcache the default cache class, for example:
    # Only set this if we're using the web server, not drush
    if(!drupal_is_cli()) {
      $conf['cache_inc'] = './sites/all/modules/memcache/memcache.inc';
    }
  6. Bring your site back online.

Drupal 7

  1. Put your site into offline mode.
  2. Download and install the memcache module.
  3. If you have previously been running the memcache module, run update.php.
  4. Edit settings.php to make memcache the default cache class, for example:
    # Only set this if we're using the web server, not drush
    if(!drupal_is_cli()) {
      $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
      // The 'cache_form' bin must be assigned no non-volatile storage.
      $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
      $conf['cache_default_class'] = 'MemCacheDrupal';
      $conf['memcache_key_prefix'] = 'something_unique';
    }
  5. Bring your site back online.
  6. Review memcache reports at admin/reports/memcache

See https://drupal.org/node/1131468 for more information