Zeile 15 | Zeile 15 |
---|
{ /** * Unique identifier representing this copy of MyBB
|
{ /** * Unique identifier representing this copy of MyBB
|
*/
| * * @var string */
|
public $unique_id;
|
public $unique_id;
|
| /** * @param bool $silent ignored */
|
function xcacheCacheHandler($silent=false) { global $mybb;
| function xcacheCacheHandler($silent=false) { global $mybb;
|
Zeile 31 | Zeile 36 |
---|
$mybb->trigger_generic_error("xcache_load_error"); die; }
|
$mybb->trigger_generic_error("xcache_load_error"); die; }
|
} }
/**
| } }
/**
|
* Connect and initialize this handler. * * @return boolean True if successful, false on failure */ function connect() {
|
* Connect and initialize this handler. * * @return boolean True if successful, false on failure */ function connect() {
|
global $mybb;
| |
// Set a unique identifier for all queries in case other forums on this server also use this cache handler $this->unique_id = md5(MYBB_ROOT);
| // Set a unique identifier for all queries in case other forums on this server also use this cache handler $this->unique_id = md5(MYBB_ROOT);
|
Zeile 52 | Zeile 55 |
---|
/** * Retrieve an item from the cache. *
|
/** * Retrieve an item from the cache. *
|
* @param string The name of the cache * @param boolean True if we should do a hard refresh
| * @param string $name The name of the cache * @param boolean $hard_refresh True if we should do a hard refresh
|
* @return mixed Cache data if successful, false if failure
|
* @return mixed Cache data if successful, false if failure
|
*/
| */
|
function fetch($name, $hard_refresh=false) { if(!xcache_isset($this->unique_id."_".$name))
| function fetch($name, $hard_refresh=false) { if(!xcache_isset($this->unique_id."_".$name))
|
Zeile 64 | Zeile 66 |
---|
return false; } return xcache_get($this->unique_id."_".$name);
|
return false; } return xcache_get($this->unique_id."_".$name);
|
}
| }
|
/** * Write an item to the cache. *
|
/** * Write an item to the cache. *
|
* @param string The name of the cache * @param mixed The data to write to the cache item
| * @param string $name The name of the cache * @param mixed $contents The data to write to the cache item
|
* @return boolean True on success, false on failure */ function put($name, $contents) { return xcache_set($this->unique_id."_".$name, $contents);
|
* @return boolean True on success, false on failure */ function put($name, $contents) { return xcache_set($this->unique_id."_".$name, $contents);
|
}
| }
|
/** * Delete a cache *
|
/** * Delete a cache *
|
* @param string The name of the cache
| * @param string $name The name of the cache
|
* @return boolean True on success, false on failure */ function delete($name) { return xcache_set($this->unique_id."_".$name, "", 1);
|
* @return boolean True on success, false on failure */ function delete($name) { return xcache_set($this->unique_id."_".$name, "", 1);
|
}
/**
| }
/**
|
* Disconnect from the cache
|
* Disconnect from the cache
|
*/
| * * @return bool */
|
function disconnect() { return true; }
|
function disconnect() { return true; }
|
| /** * @param string $name * * @return string */
|
function size_of($name) { global $lang;
| function size_of($name) { global $lang;
|