Abhishek Sanghvi
Abhishek Sanghvi

Reputation: 4651

PHP Caching on Client or Server?

I was reading about PHP Cache (APC, MemCache, etc), suddenly a question raised in my mind

The Caching in PHP is Done at which level?

  1. Either it is done on Client side or Server side?

  2. Either on Hard Disk Space or Ram Space?

Any additional details or information about it would be really helpful.

Thanks in advance.

Upvotes: 0

Views: 1400

Answers (2)

Damien Overeem
Damien Overeem

Reputation: 4529

Basics of caching systems:

  1. Install a caching system on your server (ie. memcached (http://memcached.org/)) These caching services usually cache in memory.
  2. Alter your code to work as: check for data in cache, if its not in cache, get it from file/webservice/database and store it in cache for X time.
  3. On subsequent requests do the same thing, which will cause the data to come from the caching system instead of load heavy filesystem/webservice etc.

PHP has classes for most caching systems. Ie. http://php.net/manual/en/book.memcache.php which will let you talk to your memcache server.

Installing memcached is quite easy btw, since its mostly 1 executable + 1 config file.

Upvotes: 1

chandresh_cool
chandresh_cool

Reputation: 11830

PHP caching is done on server side. It will be on hard disk obviously.

Upvotes: 3

Related Questions