Hi
The documentation is a bit confusing. (which files to use/include etc.)
Through trial and error, (I think) I figured out the configuration for Drupal 7.
Can somebody inform me that the code below is correct?
Do I still need to include $conf['cache_inc'] = 'sites/all/modules/memcache/memcache.inc'; as well?
$conf['cache_inc'] = 'sites/all/modules/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.db.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_servers'] = array(
'127.0.0.1:11211' => 'default',
'127.0.0.1:11212' => 'block',
'127.0.0.1:11213' => 'content',
'127.0.0.1:11214' => 'filter',
'127.0.0.1:11215' => 'form',
'127.0.0.1:11216' => 'menu',
'127.0.0.1:11217' => 'page',
'127.0.0.1:11218' => 'update',
'127.0.0.1:11219' => 'views',
);
$conf['memcache_bins'] = array(
'cache' => 'default',
'cache_block' => 'block',
'cache_content' => 'content',
'cache_filter' => 'filter',
'cache_form' => 'form',
'cache_menu' => 'menu',
'cache_page' => 'page',
'cache_update' => 'update',
'cache_views' => 'views',
'cache_views_data' => 'views',
);
Regards.
Comments
Comment #1
flatcircle commentedIn the installation section, I read:
Edit settings.php to include either memcache.inc or memcache.db.inc.
For example,
If I use only this, will the backend also be cached or do I have to include
as well?
Comment #2
Anonymous (not verified) commentedSeems the wrong approach,
Comment #3
flatcircle commentedI thought that the variables $conf['cache_inc'], $conf['lock_inc'], $conf['cache_backends'][] =,... were D7 specific and that I had to use these.
So according to your reply. I should add the code below to my settings.php?
Can somebody confirm that this is correct for D7?
Comment #4
Anonymous (not verified) commentedI'm using a single server:11211 and this works for me
Haven't tried the memcache_Server / bins options.
Comment #5
tomgf commentedI have tried this suggested configuration with success. Both the simple config and the memcache_servers and memcache_bins options (I haven't test it with specific log files – one per server – though).
The only thing I have to add – as I am running multiple websites – is this:
$conf['memcache_key_prefix'] = 'UNIQUE_TO_THIS_WEBSITE'; // i.e. host name
Comment #6
flatcircle commentedWhen I use:
I get the following error:
Fatal error: Cannot redeclare cache_get() (previously declared in /var/www/html/drupal7/includes/cache.inc:49) in /var/www/html/drupal7/sites/all/modules/memcache/memcache.db.inc on line 77
Comment #7
flatcircle commentedSeems like the memcache.db.inc is causing this (memcache.inc is working fine)
Comment #8
catchmemcache.db.inc is deprecated, you just want memcache.inc
Comment #9
alladdin commentedI can confirm that configuration form #2 is working:
// the path to the core cache file
include_once('./includes/cache.inc');
// the path to the memcache cache file
include_once('./sites/all/modules/memcache/memcache.inc');
// make MemCacheDrupal the default cache class
$conf['cache_default_class'] = 'MemCacheDrupal';
Comment #10
muschpusch commentedThis is a good article:
http://yoodey.com/how-install-memcached-drupal-7-ubuntu-maverick-amazon-ec2
Comment #11
jordanmagnuson commentedCan one of this module's core developers confirm this again, for Drupal 7... I've seen different methods advocated in different places, and just want to make sure of the latest confirmed method of implementation.
In settings.php should we use:
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';Or (as stated above and shown at http://drupal.org/node/1131468):
And what about
memcache-lock.inc? We don't need to include that in settings.php?Comment #12
markpavlitski commentedThe correct approach is to use:
If you also wish to use the memcache lock system you will need:
Here is an example default configuration in settings.php:
This will assign all cache bins to memcache with the exception of the cache_form special case which should be kept in the database to avoid issues when submitting forms.