What is Memcached?
An open source high-performance distributed memory object caching system.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
How to install Memcached?
Below is a guide on how to install memcached on your server.
Download the memcached package.
<br /> wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz<br /> tar -vxzf memcached-1.4.15.tar.gz<br /> ./configure</p> <p>checking for gcov... /usr/bin/gcov<br /> checking for main in -lgcov... yes<br /> checking for library containing clock_gettime... -lrt<br /> checking for library containing socket... none required<br /> checking for library containing gethostbyname... none required<br /> checking for libevent directory... configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/</p> <p> If it's already installed, specify its path using --with-libevent=/dir/</p> <p>
If the system is not able to find the libevent and libevent libraries during the configuration time then you need to install both libevent and libevent-devel packages.
<br /> yum -y install libevent libevent-devel<br />
Once memcached is installed, you need to install a memcache client to be able to access the memcached server.
<br /> pecl install memcache<br />
Run your memcached server.
<br /> /usr/bin/memcached -u nobody -d<br />
After memcache client library is compiled, you need to tell your php interpreter where to find it and use it as extension.
<br /> extension=memcache.so<br />
Now restart your web server and check your php information output. You should see the memcached module installed and enabled.
To test if your memcached server is working, check out the url below for code examples.