Minahito
minah****@users*****
2006年 9月 25日 (月) 12:22:36 JST
Index: xoops2jp/html/modules/base/kernel/Legacy_CacheInformation.class.php diff -u xoops2jp/html/modules/base/kernel/Legacy_CacheInformation.class.php:1.1.2.1 xoops2jp/html/modules/base/kernel/Legacy_CacheInformation.class.php:1.1.2.2 --- xoops2jp/html/modules/base/kernel/Legacy_CacheInformation.class.php:1.1.2.1 Sun Sep 24 23:05:19 2006 +++ xoops2jp/html/modules/base/kernel/Legacy_CacheInformation.class.php Mon Sep 25 12:22:36 2006 @@ -42,6 +42,14 @@ */ var $_mEnableCache = null; + /** + * For a special cache mechanism, free to use hashmap. + * + * @access public + * @var array + */ + var $mAttributes = array(); + function Legacy_AbstractCacheInformation() { } @@ -75,23 +83,6 @@ } /** - * Gets a cache file path. - * @return string full file path to store a cache file. - */ - function getFilePath() - { - return XOOPS_CACHE_PATH . "/" . $this->getCacheId() . ".cache.html"; - } - - /** - * [Abstract] Gets an identity token string. - * @return string - */ - function getCacheId() - { - } - - /** * Resets member properties to reuse this object. */ function reset() @@ -100,50 +91,6 @@ $this->mGroupArr = array(); $this->_mEnableCache = null; } - - /** - * Saves a buffer of the render target to a cache file. - * @param XCube_RenderTarget $renderTarget - */ - function save(&$renderTarget) - { - $filepath = $this->getFilePath(); - $fp = fopen($filepath, "wb"); - if ($fp) { - fwrite($fp, $renderTarget->getResult()); - fclose($fp); - } - } - - /** - * Loads a contents of a cache file, and return it. - * @return string - */ - function load() - { - return file_get_contents($this->getFilePath()); - } - - /** - * Gets a value indicating whether a cache file exists. - */ - function isExistCache() - { - return file_exists($this->getFilePath()); - } - - /** - * Gets a value indicating wheter a cache file keeps life time. - * @param int $cachetime - */ - function isExpireCache($cachetime) - { - if ($cachetime == 0 || !$this->isExistCache()) { - return false; - } - - return ((time() - filemtime($this->getFilePath())) <= $cachetime ); - } } class Legacy_ModuleCacheInformation extends Legacy_AbstractCacheInformation @@ -154,7 +101,7 @@ * @access protected * @var XoopsModule */ - var $_mModule = null; + var $mModule = null; /** * The current URL used as a base for a cache file name. This should be @@ -171,18 +118,13 @@ */ function setModule(&$module) { - $this->_mModule =& $module; - } - - function getCacheId() - { - return md5(XOOPS_SALT . $this->mURL . implode("_", $this->mGroupArr)); + $this->mModule =& $module; } function reset() { parent::reset(); - $this->_mModule = null; + $this->mModule = null; $this->mURL = null; } } @@ -195,7 +137,7 @@ * @access protected * @var XoopsBlock */ - var $_mBlock = null; + var $mBlock = null; /** * Sets a block object. @@ -204,18 +146,13 @@ */ function setBlock(&$block) { - $this->_mBlock =& $block; - } - - function getCacheId() - { - return md5(XOOPS_SALT . 'block' . $this->_mBlock->get('bid') . implode("_", $this->mGroupArr)); + $this->mBlock =& $block; } function reset() { parent::reset(); - $this->_mBlock = null; + $this->mBlock = null; } }