Is a PHP-only "cache engine" ever worth it?

Posted by adsads on Stack Overflow See other posts from Stack Overflow or by adsads
Published on 2010-03-20T09:54:22Z Indexed on 2010/03/20 10:01 UTC
Read the original article Hit count: 212

Filed under:
|

I wrote a rather small skeleton for my web apps and thought that I would also add a small cache for it.

It is rather simple:

  • If the current page exists as a file in the cache and the file isn't too old, read it out and exit instead of rebuilding the page

  • If the current page isn't cached/outdated recalc the page and save it

However, the bad thing about it is:

  • My performance tests with a page that receives 40 relatively long posts via a MySQL query said that with using the cache, it took even longer to handle a single request (1000 tests each)

  • How can that happen?

  • Should I just remove the complete raw-PHP cache and relieve on the availability of some PHP cache like memcached or so?

© Stack Overflow or respective owner

Related posts about php

Related posts about caching