Zeile 11 | Zeile 11 |
---|
/** * eAccelerator Cache Handler */
|
/** * eAccelerator Cache Handler */
|
class eacceleratorCacheHandler
| class eacceleratorCacheHandler implements CacheHandlerInterface
|
{ /** * Unique identifier representing this copy of MyBB
|
{ /** * Unique identifier representing this copy of MyBB
|
| * * @var string
|
*/ public $unique_id;
|
*/ public $unique_id;
|
function eacceleratorCacheHandler($silent=false)
| function __construct()
|
{ global $mybb;
| { global $mybb;
|
Zeile 32 | Zeile 34 |
---|
die; } }
|
die; } }
|
return false;
| |
}
/**
| }
/**
|
Zeile 42 | Zeile 43 |
---|
*/ function connect() {
|
*/ 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);
|
|
|
return true; }
|
return true; }
|
|
|
/** * 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
|
* @return mixed Cache data if successful, false if failure
|
* @return mixed Cache data if successful, false if failure
|
*/
function fetch($name, $hard_refresh=false) {
| */ function fetch($name) {
|
$data = eaccelerator_get($this->unique_id."_".$name); if($data === false) { return false; }
|
$data = eaccelerator_get($this->unique_id."_".$name); if($data === false) { return false; }
|
return my_unserialize($data);
| return unserialize($data);
|
}
/** * 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 boolean True on success, false on failure */ function put($name, $contents)
|
Zeile 82 | Zeile 79 |
---|
$status = eaccelerator_put($this->unique_id."_".$name, serialize($contents)); eaccelerator_unlock($this->unique_id."_".$name); return $status;
|
$status = eaccelerator_put($this->unique_id."_".$name, serialize($contents)); eaccelerator_unlock($this->unique_id."_".$name); return $status;
|
}
| }
|
/** * 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 eaccelerator_rm($this->unique_id."_".$name);
|
* @return boolean True on success, false on failure */ function delete($name) { return eaccelerator_rm($this->unique_id."_".$name);
|
}
/**
| }
/**
|
* Disconnect from the cache
|
* Disconnect from the cache
|
*/
| * * @return bool */
|
function disconnect() { return true; }
|
function disconnect() { return true; }
|
function size_of($name)
| /** * @param string $name * * @return string */ function size_of($name='')
|
{ global $lang;
| { global $lang;
|