Index: branches/5.2.x/core/kernel/utility/cache.php =================================================================== diff -u -N -r13840 -r14092 --- branches/5.2.x/core/kernel/utility/cache.php (.../cache.php) (revision 13840) +++ branches/5.2.x/core/kernel/utility/cache.php (.../cache.php) (revision 14092) @@ -1,6 +1,6 @@ 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 @@ -213,10 +231,6 @@ */ function prepareKeyName($name, $replace_serials = true) { - if ($this->cachingType == CACHING_TYPE_TEMPORARY) { - return $name; - } - // replace serials in key name if ($replace_serials && preg_match_all('/\[%(.*?)%\]/', $name, $regs)) { // [%LangSerial%] - prefix-wide serial in case of any change in "lang" prefix @@ -227,6 +241,10 @@ } } + if ($this->cachingType == CACHING_TYPE_TEMPORARY) { + return $name; + } + // add site-wide prefix to key return $this->_cachePrefix() . $name; } @@ -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) @@ -398,7 +415,15 @@ $servers = explode(';', $memcached_servers); foreach ($servers as $server) { - list ($server, $port) = strpos($server, ':') !== false ? explode(':', $server, 2) : Array ($server, 11211); + if ( preg_match('/(.*):([\d]+)$/', $server, $regs) ) { + // "hostname:port" OR "unix:///path/to/socket:0" + $server = $regs[1]; + $port = $regs[2]; + } + else { + $port = 11211; + } + $this->_handler->addServer($server, $port); } @@ -442,7 +467,7 @@ */ function delete($name) { - return $this->_handler->delete($name); + return $this->_handler->delete($name, 0); } /**