Index: branches/5.1.x/core/kernel/utility/cache.php =================================================================== diff -u -N -r13171 -r13180 --- branches/5.1.x/core/kernel/utility/cache.php (.../cache.php) (revision 13171) +++ branches/5.1.x/core/kernel/utility/cache.php (.../cache.php) (revision 13180) @@ -1,6 +1,6 @@ _enabled; } + } + + class XCacheCacheHandler { + + var $_enabled = false; + + var $cachingType = CACHING_TYPE_MEMORY; + + function XCacheCacheHandler() + { + $this->_enabled = function_exists('xcache_get'); + + // verify, that xcache is working + if ($this->_enabled && !$this->set('test', 1)) { + $this->_enabled = false; + } + } + + /** + * Retrieves value from cache + * + * @param string $name + * @return mixed + */ + function get($name) + { + return xcache_isset($name) ? xcache_get($name) : false; + } + + /** + * Stores value in cache + * + * @param string $name + * @param mixed $value + * @param int $expiration + * @return bool + */ + function set($name, $value, $expiration = 0) + { + return xcache_set($name, $value, $expiration); + } + + /** + * Deletes key from cache + * + * @param string $name + * @return bool + */ + function delete($name) + { + return xcache_unset($name); + } + + /** + * Determines, that cache storage is working fine + * + * @return bool + */ + function isWorking() + { + return $this->_enabled; + } } \ No newline at end of file