2009
09.30

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

To use it with C++ apps you also need libmemcached which is client library to the memcached server. It has been designed to be light on memory usage, thread safe, and provide full access to server side methods.

As far as I know there is no Debian package for libmmemcached but there is one for memcached.

Installing memcache

The easiest way is to install it via APT:

user@computer:$ apt-get install memcached

Installing libmemcached

You will have to compile it yourself using source code

user@computer:$ cd /usr/local/src/
wget http://download.tangent.org/libmemcached-0.39.tar.gz
tar -zxf libmemcached-0.39.tar.gz
cd libmemcached-0.39
./configure
make
make install

For some reason it did not work until I created this symlink (C++ was looking for this lib here)

user@computer:$ cd /usr/lib/
ln -s /usr/local/lib/libmemcached.so.2 .

I’ve put all those commands in a small SH script:

#!/bin/sh
echo "Installing memcached"
apt-get install -y memcached
echo "Installing libmemcached-0.39"
cd /usr/local/src/
wget http://download.tangent.org/libmemcached-0.39.tar.gz
tar -zxf libmemcached-0.39.tar.gz
cd libmemcached-0.39
./configure
make
make install
echo "Creating symlink /usr/lib/libmemcached.so.2 => /usr/local/lib/libmemcached.so.2"
cd /usr/lib/
ln -s /usr/local/lib/libmemcached.so.2 .
echo "Installation finished"

 

P.S. Some sentances were stolen from memcached and libmemecached websites, I’m too lazy to write something that was already written.

Bookmark and Share

4 comments so far

Add Your Comment
  1. wow. i love you. you saved my life. i owe you a beer if you’re ever in SF.

  2. @Oliver Nassar Not going to SF but you can get me a beer, just use Donate button on the right ;)

  3. to avoid the symlink try this:
    ./configure –prefix=/usr

  4. Thanks for a tip, I’ll check it out next time I’ll have to install memcached :)