www.gusucode.com > Carbon Forum PHP轻论坛系统 v3.6.5源码程序 > Carbon-Forum-3.6.5/includes/XCache.class.php

    <?php
// http://xcache.lighttpd.net/wiki/XcacheApi
class XCache
{
	public function __construct()
	{
		return extension_loaded('xcache');
	}

	public function set($key, $value, $expire = 86400)
	{
		if (!$key) {
			return false;
		}
		return xcache_set($key, $value, $expire);
	}

	public function get($key)
	{
		if (!$key) {
			return false;
		}
		return xcache_isset($key) ? xcache_get($key) : false;
	}

	public function delete($key)
	{
		if (!$key) {
			return false;
		}
		return xcache_unset($key);
	}

	public function flush()
	{
		return xcache_clear_cache(XC_TYPE_VAR, 0);
	}
}