2

I am up to here in drupal documentation :

Start at least one instance of memcached on your server. Edit settings.php to make memcache the default cache class, for example: $conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc'; $conf['cache_default_class'] = 'MemCacheDrupal'; $conf['memcache_key_prefix'] = 'something_unique';

Why do I need a memcache key prefix if have only one database? Anyway where and how do I set it?

4

All those settings are added to settings.php

usually sites/default/settings.php

$conf['cache_backends'][] = 'sites/all/modules/contrib/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_key_prefix'] = 'k1';
// Use database for cache_form
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

You only need a memcache key prefix if you're using memcache with more than one site on that server. Adding a short key, e.g $conf['memcache_key_prefix'] = 'k1'; is good practice.

  • Thank you. I didn't use a prefix and also used the following which has it up and running:include_once('./includes/cache.inc'); include_once('./sites/all/modules/memcache/memcache.inc'); $conf['cache_default_class'] = 'MemCacheDrupal'; – Ann Jan 14 '13 at 10:28
  • 1
    If you have a larger site and don't want AJAX or form cache functionality to break, add this as well: $conf['cache_class_cache_form'] = 'DrupalDatabaseCache'; – Steven Linn Dec 4 '14 at 17:36
  • @StevenLinn, thanks, cache_form exclusion rule added for completeness. – David Thomas Jan 23 '15 at 9:48
0

Solution for Drupal 8: (also in settings.php)

$settings['memcache']['key_prefix'] = 'something_unique';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.