Install Memcached with Rails

To Install Memcached and use it with rails

Install libevent first :

curl -O
tar xzvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure --prefix=/usr/local
make verify
sudo make install

install memcached

curl -O
$ tar xzvf memcached-1.4.4.tar.gz
$ cd memcached-1.4.4
$ ./configure --prefix=/usr/local
$ make
$ make test
$ sudo make install

Run Memcached by default (with 64mb ram)


Run Memcached in verbose mode

memcached -vv

Run memcached as a daemon with pidfile on specific ip

memcached -d -P pidfile -l

To Stop Memcached

killall memcached

To connect memcached with rails, i using gem called memcached, install it by calling

sudo gem install memcached

to use it with rails, just add rails environment.rb

require "memcached"
CACHE ='')

Using memcached by calling the CACHE variabel, example :


Thats all, hope that helps


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s