From: alex <bin...@li...> - 2001-08-08 19:26:46
|
alex Wed Aug 8 12:26:40 2001 EDT Added files: /r2/binarycloud/base/mgr CacheManager.php Log: This is the CacheManager, which contains code moved out from page (and some new stuff) for managing caches of page output, module group output, and module output. This is not for generalized caching, for that you can use the pear cache class. Index: r2/binarycloud/base/mgr/CacheManager.php +++ r2/binarycloud/base/mgr/CacheManager.php <?php // Header {{{ /* * -File $Id: CacheManager.php,v 1.1 2001/08/08 19:26:40 alex Exp $ * -License LGPL (http://www.gnu.org/copyleft/lesser.html) * -Copyright 2001, The Turing Studio, Inc. * -Author alex black, en...@tu... */ $PACKAGE='binarycloud.mgr'; // }}} // {{{ CacheManager /** * This is the CacheManager class, it * */ class CacheManager { // {{{ method CheckCache() /** * This method * * @access public */ function CheckCache($type) { $valid_cache = false; switch ($type) { case 'page': $valid_cache = $this->_CheckPageCache(); break; case 'module_group': $valid_cache = $this->_CheckModuleGroupCache(); break; case 'module': $valid_cache = $this->_CheckModuleCache(); break; } return $valid_cache; } // }}} // {{{ method GetPayload() /** * This method * * @access private */ function GetPayload() { return $this->payload; } // }}} // {{{ method _CheckPageCache() /** * This method * * @access private */ function _CheckPageCache() { global $Cache; global $gPageDef; $var_name =& $gPageDef['cache']['var']; $this->page_cache['expires'] =& $gPageDef['cache']['expires']; $this->page_cache['seed'] = $HTTP_SERVER_VARS['REQUEST_URI'].":".$var_name.":".$$var_name; $this->page_cache['id'] = $Cache->generateID($this->page_cache['seed']); $this->page_cache['is_cached'] = $Cache->isCached($this->page_cache['id'],'pages'); $this->page_cache['is_expired'] = $Cache->isExpired($this->page_cache['id'],'pages'); if ($this->page_cache['is_cached'] == true && $this->page_cache['is_expired'] == false) { $this->page_cache['is_valid'] = true; $this->_SetPayload($Cache->get($this->page_cache['id'],'pages')); return true; } else { $this->page_cache['is_valid'] = false; return false; } } // }}} // {{{ method _CheckModuleGroupCache() /** * This method * * @access private */ function _CheckModuleGroupCache() { global $Cache; } // }}} // {{{ method _CheckModuleCache() /** * This method * * @access private */ function _CheckModuleCache() { global $Cache; } // }}} // {{{ method _SetPayload() /** * This method * * @access private */ function _SetPayload($payload) { $this->payload = $payload; } // }}} // {{{ Vars var $page_cache; var $payload; // }}} } // }}} ?> |