As most developers know memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications.
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
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.
Installing Memcached in your server:
# yum install memcached
# nano -w /etc/sysconfig/memcached
The values I normally use (depending on what the server is for):
PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="512" OPTIONS=""
Set Memcached to start automatically on boot:
# chkconfig memcached on
# /etc/init.d/memcached start
Install PHP memcache Module:
First, make sure you have all needed libraries on the server so the installation is quick and free of issues.
# yum install php-devel # yum install zlib-devel
Once those libraries are on the server lets use PECL to download and install memcache from repository:
# pecl install memcache
To enable the PHP extension you should edit your php.ini configuration file and add this to the end of the file:
extension = memcache.so
# /etc/ini.d/httpd restart
You can check that you have successfully installed memcache via phpinfo().
Go to your HTTP directory
# cd /var/www/html/
Create and edit the file
# nano info.php
Paste the following lines:
<?php phpinfo(); ?>
Hit Control+X, nano will ask if you want to save the changes hit Y and hit Enter
Browse to your HTTP directory and run the file http://localhost/info.php
Tags CloudAndroid APC APC Cache bash Blackberry CentOS clamscan co cpanel databases HTML 5 install memcache iPhone linux load balanced servers memcache Memcached memcahed sessions MySQL PHP php sessions Server Cache shell ssh sticky notes available text formats sticky notes commands Sticky Notes format viruses webOS website antivirus website infections