Memcache is a very simple caching system that uses memory to store objects. As you may already know, memory is faster to read than hard drive. A site will take a lot less time to read a database result cached in memory. To make the best use of memcache, you should install the memcached module. For this post we used Ubuntu Server 10.04, but all commands should work on most Ubuntu editions.
I have chosen to use memcached, rather than memcache. Have a look here to view a comparison
First, install the memcached package, php-pear (required for pecl), php5-dev (required for phpize) and libmemcached-dev
sudo apt-get install memcached sudo apt-get install php-pear sudo apt-get install php5-dev sudo apt-get install libmemcached-dev |
next, install memcached using pecl
sudo pecl install Memcache |
Also, we need to enable the memcache extension on php:
sudo echo "extension=memcache.so" > /etc/php5/apache2/conf.d/memcache.ini |
Add the following line to your php.ini file.
memcache.hash_strategy="consistent" |
You can add it anywhere in the file.
Next you need to start an instance of memcache, you can start a daemon with the following command:
memcached -d -m 2048 -l 10.0.0.40 -p 11211 |
If you are only using a single server, then you only need to include this line to your site’s settings.php file.
$conf['cache_inc'] = '/sites/all/modules/memcache/memcache.inc'; |
The final step is to restart apache and then switch your site back online if it was offline.

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 
New Blog Post -> Installing memcached on ubuntu 10.04 – http://www.zayinkrige.com/installing-mem…
Installing memcached on ubuntu 10.04…
Memcache is a very simple caching system that uses memory to store objects. As you may already know, memory is faster to read than hard drive. A site will take a lot less time to read a database result cached in memory. To make the best use of memcache…
[...] http://www.zayinkrige.com/installing-memcached-on-ubuntu-10-04/ Share this:TwitterFacebookLike this:LikeBe the first to like this. Leave a Comment [...]