Friday, 31 January 2014

What is memcache and why you use memcache for your website

Memcache with PHP Memcache is Free & open source, high-performance, distributed memory object caching system which improves the website performance In simple words every time your website opens it fetches data from database. Memcache cache this data locally on temporary cache so that every time your website page open it won’t run sql queries to fetch data from DB.

How to Install Memcache in Ubuntu

To install memcache in ubuntu run the following command
 sudo apt-get install memcached
once memcache is install you can set the configuration
sudo gedit /etc/memcached.conf
after open this file you can find the default caching memory and port is
     -m 64 //64 MB
      -p 11211
Set as per requirement.
You can check whether memcached service is running or not by using command
sudo service memcahed status
How to use Memcache For PHP
define('HOST', '');
define('PORT', '27645');

$memcache = new Memcache;
$cacheAvailable = $memcache->connect(HOST, PORT);
More Info Click Here

No comments:

Post a Comment