cvs: php4 /pear/Cache OutputCompression.php
| From: | Christian Stocker | Date: | Mon, 26 Nov 2001 15:16:13 +0000 |
| Subject: | cvs: php4 /pear/Cache OutputCompression.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1410@lists.php.net to get a copy of this message | ||
chregu Mon Nov 26 10:16:13 2001 EDT
Modified files:
/php4/pear/Cache OutputCompression.php
Log:
an usage example
Index: php4/pear/Cache/OutputCompression.php
diff -u php4/pear/Cache/OutputCompression.php:1.5 php4/pear/Cache/OutputCompression.php:1.6
--- php4/pear/Cache/OutputCompression.php:1.5 Fri Aug 10 12:12:34 2001
+++ php4/pear/Cache/OutputCompression.php Mon Nov 26 10:16:12 2001
@@ -20,10 +20,37 @@
/**
* Cache using Output Buffering and contnet (gz) compression.
+** Usage example:
+*
+* // place this somewhere in a central config file
+* define(CACHE_STORAGE_CLASS, 'file');
+* // file storage needs a dir to put the cache files
+* define(CACHE_DIR, '/var/tmp/');
+*
+* // get a cache object
+* $cache = new Cache_Output(CACHE_STORAGE_CLASS, array('cache_dir' => CACHE_DIR));
+*
+* if (!($content = $cache->start($cache->generateID($REQUEST_URI)))) {
+* print "hello world";
+* $cache->endPrint(+1000);
+* }
+* else {
+* $cache->printContent();
+* }
+*
+* OR
+*
+* if (($content = $cache->start($cache->generateID($REQUEST_URI)))) {
+* $cache->printContent();
+* die();
+* }
+* print "hello world";
+* $cache->endPrint(+1000);
+*
*
* Based upon a case study from Christian Stocker and inspired by jpcache.
*
-* @version $Id: OutputCompression.php,v 1.5 2001/08/10 16:12:34 sebastian Exp $
+* @version $Id: OutputCompression.php,v 1.6 2001/11/26 15:16:12 chregu Exp $
* @author Ulf Wendel <ulf.wendel@phpdoc.de>, Christian Stocker <chregu@nomad.ch>
* @access public
* @package Cache
@@ -153,8 +180,8 @@
global $HTTP_SERVER_VARS;
if ('' == $content)
- $content = &$this->content;
-
+ $content = &$this->container->cachedata;
+
if ($this->compression && $this->caching) {
$etag = 'PEAR-Cache-' . md5(substr($content, -40));