username = $spin->config->cache['xcache.username']; $this->password = $spin->config->cache['xcache.password']; if (!$this->username || !$this->password) throw new CacheConfigError( "The xcache caching backend is enabled, but the username " . "and/or password are not set in the configuration" ); } // }}} // {{{ Method: put() public function put($bin, $key, $val, $ttl = 300, $version = NULL) { @xcache_set($bin.'_'.$key, array($val,$version), $ttl); } // }}} // {{{ Method: get() public function get($bin, $key, $version = NULL) { @$get = xcache_get($bin.'_'.$key); if (is_array($get) && count($get) && ($version == NULL || $get[1] != NULL && $get[1] == $version)) { return $get[0]; } return NULL; } // }}} // {{{ Method: del() public function del($bin, $key) { @xcache_unset($bin.'_'.$key); } // }}} // {{{ Method: purge() public function purge() { // Login for xcache admin // Oh if you find this ugly, blame the xcache guys. $_SERVER["PHP_AUTH_USER"] = $this->username; $_SERVER["PHP_AUTH_PW"] = $this->password; @xcache_clear_cache(XC_TYPE_VAR, 0); } // }}} } ?>