This post originated from an RSS feed registered with PHP Buzz
by Stephan Schmidt.
Original Post: HTTP_Cache released
Feed Title: a programmer's best friend
Feed URL: http://blog.php-tools.net/rss.php?version=1.0
Feed Description: The blog of PHP Application Tools
I just released HTTP_Cache 0.1.0 through our own PEAR-Channel at pear.php-tools.net. I proposed this package via PEPr some time ago, but because some of the functionality already is available in the packages HTTP_Header and HTTP_Download I never initiated the call for votes. But still I think this small package is quite useful when you need HTTP-Caching using ETag. As it supplies a handler for PHP's output buffering all you need to add to your scripts are two lines of code: require_once 'HTTP/Cache.php';
$cache = &new HTTP_Cache(array('auto' => true));
echo "You now may send any data to the browser";
If a user now requests this page twice, it will be only sent to the browser once, unless the output has changed in the meantime.
If you are using PEAR 1.4 installing the package is nearly as easy as installing a package from PEAR: $ pear channel-discover pear.php-tools.net
$ pear install pat/HTTP_Cache
The package will be get installed in the PEAR directory of you server and you can instantly start to use it.