splitbrain.org

electronic brain surgery since 2001

foocache

foocache is a simple caching system for PHP4 which optionally uses HTML-tidy to clean up the generated HTML Code.

Instead of processing the whole page a cachefile is loaded if it exists, is younger than a defined age, a given reference file and the calling PHP file it self.

The name of the cache file is generated with the MD5 sum of the Request URI and the HTML post variables. foocache can highlight (search)strings in the output, too.

Example:

<?
  $foocache[query] = $_GET[search];
  require "foocache.inc";
  foocache_start();
?>
 
Here comes HTML, database queries and a lot of PHP stuff
which takes some time...
All the words given in the GET variable "search" will be
highlighted, too.
 
<?
  foocache_stop();
?>

Download: foocache.tgz

Changes

  • 20.10.2003
    • Fixed small bug with regexp quoting on searchstring highlight
  • 24.05.2003
    • Search-String highlighting was added
  • 08.04.2003
    • now ob_get_length() is used instead of strlen() to get buffered content length (thanks to Pawel Krawczyk)
    • additional options for tidy can be set with a variable - fixes problems with non iso-8859-1 input
  • 07.04.2003
    • Fixed the cachefilenaming with post variables
    • foocache now can be disabled by setting a define