Zeile 11 | Zeile 11 |
---|
/** * Memcached Cache Handler */
|
/** * Memcached Cache Handler */
|
class memcachedCacheHandler
| class memcachedCacheHandler implements CacheHandlerInterface
|
{ /** * The memcached server resource
|
{ /** * The memcached server resource
|
| * * @var Memcached
|
*/ public $memcached;
/** * Unique identifier representing this copy of MyBB
|
*/ public $memcached;
/** * Unique identifier representing this copy of MyBB
|
| * * @var string
|
*/ public $unique_id;
|
*/ public $unique_id;
|
function memcachedCacheHandler($silent=false)
| function __construct()
|
{ global $mybb;
| { global $mybb;
|
Zeile 45 | Zeile 49 |
---|
* @return boolean True if successful, false on failure */ function connect()
|
* @return boolean True if successful, false on failure */ function connect()
|
{
| {
|
global $mybb, $error_handler;
$this->memcached = new Memcached;
| global $mybb, $error_handler;
$this->memcached = new Memcached;
|
Zeile 89 | Zeile 93 |
---|
/** * 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 = $this->memcached->get($this->unique_id."_".$name);
| { $data = $this->memcached->get($this->unique_id."_".$name);
|
Zeile 112 | Zeile 114 |
---|
/** * 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 123 | Zeile 125 |
---|
/** * 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
|
* @return boolean True on success, false on failure
|
*/
| */
|
function delete($name)
|
function delete($name)
|
{
| {
|
return $this->memcached->delete($this->unique_id."_".$name);
|
return $this->memcached->delete($this->unique_id."_".$name);
|
}
| }
|
/** * Disconnect from the cache */ function disconnect() {
|
/** * Disconnect from the cache */ function disconnect() {
|
@$this->memcached->close();
| @$this->memcached->quit();
|
}
|
}
|
function size_of($name)
| /** * @param string $name * * @return string */ function size_of($name='')
|
{ global $lang;
| { global $lang;
|