Index: kernel/utility/cache.php =================================================================== --- kernel/utility/cache.php (revision 13986) +++ kernel/utility/cache.php (working copy) @@ -62,10 +62,28 @@ */ var $displayCacheStatistics = false; + /** + * Site key name + * Prepended to each cached key name + * + * @var string + */ + var $siteKeyName = ''; + + /** + * Site key value + * Prepended to each cached key name + * + * @var string + */ + var $siteKeyValue = null; + function kCache() { parent::kBase(); + $this->siteKeyName = 'site_serial:' . crc32(SQL_TYPE . '://' . SQL_USER . ':' . SQL_PASS . '@' . SQL_SERVER . ':' . TABLE_PREFIX); + // get cache handler class to use if (array_key_exists('CacheHandler', $GLOBALS['vars']) && $GLOBALS['vars']['CacheHandler']) { // for advanced users, who want to save one SQL on each page load @@ -239,21 +257,20 @@ */ function _cachePrefix($only_site_key_name = false) { - // don't use SERVER_NAME here, because it may be cron, or command line request also - $site_key = 'site_serial:' . crc32(FULL_PATH); - if ($only_site_key_name) { - return $site_key; + return $this->siteKeyName; } - $site_serial = $this->_handler->get($site_key); + if ( !isset($this->siteKeyValue) ) { + $this->siteKeyValue = $this->_handler->get($this->siteKeyName); - if (!$site_serial) { - $site_serial = 1; - $this->_handler->set($site_key, $site_serial); + if (!$this->siteKeyValue) { + $this->siteKeyValue = 1; + $this->_handler->set($this->siteKeyName, $this->siteKeyValue); + } } - return "$site_key:$site_serial:"; + return "{$this->siteKeyName}:{$this->siteKeyValue}:"; } function setStatistics($name, $found)