File based caching under PHP

Posted by azatoth on Stack Overflow See other posts from Stack Overflow or by azatoth
Published on 2010-05-31T18:29:32Z Indexed on 2010/05/31 18:33 UTC
Read the original article Hit count: 256

Filed under:
|

I've been using http://code.google.com/p/phpbrowscap/ for a project, and it usually works nice. But a few times it's cache, which is plain php-files (see http://code.google.com/p/phpbrowscap/source/browse/trunk/browscap/Browscap.php#372 et. al.), has been "zeroed", i.e. the whole cache file has become large blob of NULLs.

Instead of trying to find out why the files become NULL, I though perhaps it might be better to change the caching strategy to something more resilient.

So I do wonder if you has any good ideas what would be a good solution; I've been looking at http://www.jongales.com/blog/2009/02/18/simple-file-based-php-cache-class/ and http://www.phpclasses.org/package/313-PHP-Cache-arbitrary-data-in-files-.html and I also though of just saving an serialized array to the file instead of pure php as it's been doing now; But I'm uncertain what approach I should target here.

I'm grateful for any insight into this area of technology, as I know it's complex from a performance point of view.

© Stack Overflow or respective owner

Related posts about php

Related posts about caching