From: alex <bin...@li...> - 2001-08-16 20:44:03
|
alex Thu Aug 16 13:43:57 2001 EDT Modified files: /r2/binarycloud/base/mgr CacheManager.php Log: Many bugfixes, some reorganization. Now properly functions in conjunction with Page to cache Module output. Index: r2/binarycloud/base/mgr/CacheManager.php diff -u r2/binarycloud/base/mgr/CacheManager.php:1.4 r2/binarycloud/base/mgr/CacheManager.php:1.5 --- r2/binarycloud/base/mgr/CacheManager.php:1.4 Thu Aug 16 10:08:24 2001 +++ r2/binarycloud/base/mgr/CacheManager.php Thu Aug 16 13:43:57 2001 @@ -1,7 +1,7 @@ <?php // Header {{{ /* - * -File $Id: CacheManager.php,v 1.4 2001/08/16 17:08:24 alex Exp $ + * -File $Id: CacheManager.php,v 1.5 2001/08/16 20:43:57 alex Exp $ * -License LGPL (http://www.gnu.org/copyleft/lesser.html) * -Copyright 2001, The Turing Studio, Inc. * -Author alex black, en...@tu... @@ -26,9 +26,19 @@ function CacheOutput($output, $group) { global $Cache; global $Debug; - - $Cache->save($this->page['id'],$output,$this->page['expires'],$group); - $Debug->CaptureMessage('CacheManager', "Cached $group output in ".$this->page['id']); + global $CacheManager; + switch ($group) { + case 'page': + $id =& $this->page['id']; + $expires =& $this->page['expires']; + break; + case 'module': + $id =& $this->module['id']; + $expires =& $this->module['expires']; + break; + } + $Cache->save($id,$output,$expires,$group); + $Debug->CaptureMessage('CacheManager', "Cached $group output in ".$id); } // }}} @@ -54,7 +64,6 @@ function GetModuleCache() { global $Cache; - echo "returning mod cache"; return $Cache->get($this->module['id'],'module'); } @@ -74,12 +83,14 @@ switch ($type) { case 'page': $this->page['seed'] = $HTTP_SERVER_VARS['REQUEST_URI']; - if ($gPageDef['cache']['var']) { + if (isset($gPageDef['cache']['var'])) { $var_name =& $gPageDef['cache']['var']; $this->page['seed'] .= ":".$var_name.":".$$var_name; } $this->page['id'] = $Cache->generateID($this->page['seed']); - $this->page['expires'] =& $gPageDef['cache']['expires']; + if (isset($gPageDef['cache']['expires'])) { + $this->page['expires'] =& $gPageDef['cache']['expires']; + } $this->page['is_cached'] = $Cache->isCached($this->page['id'],$type); $this->page['is_expired'] = $Cache->isExpired($this->page['id'],$type); if ($this->page['is_cached'] == true && $this->page['is_expired'] == false) { @@ -99,7 +110,7 @@ $this->module['seed'] .= $HTTP_SERVER_VARS['REQUEST_URI']; } $this->module['id'] = $Cache->generateID($this->module['seed']); - $this->module['expires'] =& $gPageDef['cache']['expires']; + $this->module['expires'] =& $mod['cache']['expires']; $this->module['is_cached'] = $Cache->isCached($this->module['id'],$type); $this->module['is_expired'] = $Cache->isExpired($this->module['id'],$type); if ($this->module['is_cached'] == true && $this->module['is_expired'] == false) { @@ -121,4 +132,4 @@ // }}} } // }}} -?> +?> \ No newline at end of file |