Drupal 7怎么安装Memcached模块

论坛: 
That’s the server installation out of the way. Now let’s install and configure the Memcached Drupal module which integrates Drupal’s caching system with Memcached. Start by putting your site in offline mode and download and enable the Memcached module. Then add the following to settings.php:

<?php
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
?>

If you’re using a multi-site installation it’s very important to add this to each settings.php file, changing the unique_key for each installation:

<?php
$conf['memcache_key_prefix'] = 'unique_key';
?>

Put your site back in online-mode and you’re done! The Memcached module also ships with an Admin submodule which you can enable to see how Memcached is performing. Once you’re happy with your settings I would go back and disable this module as it is unnecessary for day to day activities.

UPDATE (4/10/2013): I’ve updated and tweaked this article with additional information. Everything should still be pretty relavent.

UPDATE (5/24/2013): I recently came across this handy little script that will give you improved UI statistics of memcached and how it’s performing. Just throw this file in your Drupal root directory, make sure to update the username and password, and voilà! All done.

As a point of reference, a safe goal should be to consume ~90% of the memory allocated to memcache. If you ever hit 100% the system will constantly be adding and dumping queries from the cache, hurting your overall performance.
Tags: