From: alex <bin...@li...> - 2001-08-08 23:04:57
|
alex Wed Aug 8 16:04:52 2001 EDT Removed files: /r2/binarycloud/base/core Cache.php Modified files: /r2/binarycloud/base/core Page.php Log: This is now CacheManager. Index: r2/binarycloud/base/core/Page.php diff -u r2/binarycloud/base/core/Page.php:1.13 r2/binarycloud/base/core/Page.php:1.14 --- r2/binarycloud/base/core/Page.php:1.13 Wed Aug 1 15:49:50 2001 +++ r2/binarycloud/base/core/Page.php Wed Aug 8 16:04:52 2001 @@ -1,7 +1,7 @@ <?php // Header {{{ /* - * -File $Id: Page.php,v 1.13 2001/08/01 22:49:50 alex Exp $ + * -File $Id: Page.php,v 1.14 2001/08/08 23:04:52 alex Exp $ * -License LGPL (http://www.gnu.org/copyleft/lesser.html) * -Copyright 2001, The Turing Studio, Inc. * -Authors alex black, en...@tu... @@ -37,15 +37,17 @@ function BuildPage() { global $gPageDef; global $Debug; + global $Page; if ($gPageDef['cache']) { - $this->caching = true; - $this->_check_page_cache(); + global $CacheManager; + $this->cached = $CacheManager->CheckCache('page'); } - if ($this->cache['is_valid'] == true && $this->cache['payload'] != "") { - echo $this->cache['payload']; - $Debug->CaptureMessage('Page', "Sent output from cache with id ".$this->cache['id']); + if ($this->cached == true) { + $Debug->CaptureMessage('Page', "Used cache with id ".$CacheManager->page_cache['id']); + $this->output =& $CacheManager->payload; + echo $this->output; } else { $this->title = $gPageDef['title']; foreach (array_keys($gPageDef['modules']) as $group) { @@ -55,62 +57,9 @@ } $Debug->CaptureMessage('Page', "Built page from modules."); $this->_ApplyMasterTemplate(); - - } - } - // }}} - // {{{ method _check_page_cache() - /** - * This method - * - * @access private - */ - - function _check_page_cache() { - global $Cache; - global $HTTP_SERVER_VARS; - - global $moo; - global $$var_name; - - $moo = "choo test"; - $var_name = $gPageDef['cache']['var']; - - $this->cache['expires'] = $gPageDef['cache']['expires']; - $this->cache['seed'] = $HTTP_SERVER_VARS['REQUEST_URI'].":".$var_name.":".$$var_name; - $this->cache['id'] = $Cache->generateID($this->cache['seed']); - $this->cache['is_cached'] = $Cache->isCached($this->cache['id'],'pages'); - $this->cache['is_expired'] = $Cache->isExpired($this->cache['id'],'pages'); - - if ($this->cache['is_cached'] == true && $this->cache['is_expired'] == false) { - $this->cache['is_valid'] = true; - $this->cache['payload'] =& $Cache->get($this->cache['id'],'pages'); - return true; - } else { - $this->cache['is_valid'] = false; - return false; } } - - // }}} - // {{{ method _cache_output($cache_group) - /** - * This method - * - * @access private - */ - - function _cache_output($cache_group) { - global $Cache; - global $Debug; - - $Cache->save($this->cache['id'],ob_get_contents(),$this->cache['expires'],$cache_group); - $Debug->CaptureMessage('Page', "Cached output for group: $cache_group."); - } - - - // }}} // {{{ method _GetModuleOutput($_group) /** * This method goes through each module group, for each module within @@ -165,6 +114,20 @@ */ function _ApplyLayoutTemplates($_group) { global $gPageDef; + +/* + if ($gPageDef['modules'][$_group]['cache']) { + global $CacheManager; + + if (!class_exists(CacheManager)) { + import('binarycloud.mgr.CacheManager'); + global $CacheManager; + $CacheManager = new CacheManager(); + $this->cache['is_valid'] = $CacheManager->CheckCache('module_groups',$_group); + $this->cache['caching'] = true; + } +*/ + $layout =& $gPageDef['modules'][$_group]['layout']; if (isset($layout)) { ob_start(); @@ -201,17 +164,17 @@ echo join('', $this->output); } - if ($this->caching == true) { - $this->_cache_output('pages'); + if ($gPageDef['cache']) { + global $CacheManager; + $CacheManager->CachePage(); } } // }}} // {{{ Vars var $modules_id; var $modules; + var $cached; var $output; - var $caching; - var $cache; var $title; // }}} } |