tags:

views:

21

answers:

2

What is the advantage of PHP data cache ?

Where i can use that , is it good only for browser search or

it is good for data export to csv or text also .

How can i achieve data cache using PHP?

+1  A: 

Theres a Bunch of Caches for PHP, for starters i would recommend APC http://php.net/manual/de/book.apc.php since scv and text are just strings every Cache Backend including APC is perfectly for caching them.

Hannes
Thanks for the info. Will go through the documentation.
zod
You are welcome, the hardest part is the installation after that its childsplay :)
Hannes
A: 

If you're generating data and you want to prevent computation of the same data over and over again, a good cache to look into is Memcached. Memcached is a piece of software that you run on your server. It stores anything you give it in key/value format in memory, and returns those values when you ask for them on subsequent requests. It isn't persistent (if your server goes down, everything is wiped out), though this can be useful for debugging or management purposes.

Companies like Digg and Facebook, which both rely heavily on PHP, use Memcached extensively to make sure their respective sites are fast.

Personally, I use Memcached to store things like URL routing information (40ms/request speed increase), feed caching (1-3sec/request speed increase), and social graph caching (300-400ms/request speed increase). Depending on what kind of computation you're performing, you can see various types of increases. Generally, for reasonably sized data sets (i.e.: a 1000+ line CSV file), you'll see pretty substantial increases in speed. Keep in mind, though, that Memcached uses RAM and not disk space for storage, so you can easily run out of memory if it is not properly configured. Placing Memcached on a separate server can help to alleviate this, especially on servers with PHP scripts that use a lot of memory.

Hope this helps!

mattbasta