Vergleich inc/cachehandlers/memcache.php - 1.8.1 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
/**
* Memcache Cache Handler
*/

/**
* Memcache Cache Handler
*/

class memcacheCacheHandler

class memcacheCacheHandler implements CacheHandlerInterface

{
/**
* The memcache server resource

{
/**
* The memcache server resource

 
	 *
* @var Memcache

	 */
public $memcache;

/**
* Unique identifier representing this copy of MyBB

	 */
public $memcache;

/**
* Unique identifier representing this copy of MyBB

 
	 *
* @var string

	 */
public $unique_id;


	 */
public $unique_id;


	function memcacheCacheHandler($silent=false)

	function __construct()

	{
global $mybb;


	{
global $mybb;


Zeile 45Zeile 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;


		global $mybb, $error_handler;


		$this->memcache = new Memcache;


		$this->memcache = new Memcache;


		if($mybb->config['memcache']['host'])

		if($mybb->config['memcache']['host'])

		{

		{

			$mybb->config['memcache'][0] = $mybb->config['memcache'];
unset($mybb->config['memcache']['host']);
unset($mybb->config['memcache']['port']);

			$mybb->config['memcache'][0] = $mybb->config['memcache'];
unset($mybb->config['memcache']['host']);
unset($mybb->config['memcache']['port']);

Zeile 60Zeile 64
		foreach($mybb->config['memcache'] as $memcache)
{
if(!$memcache['host'])

		foreach($mybb->config['memcache'] as $memcache)
{
if(!$memcache['host'])

			{

			{

				$message = "Please configure the memcache settings in inc/config.php before attempting to use this cache handler";
$error_handler->trigger($message, MYBB_CACHEHANDLER_LOAD_ERROR);
die;

				$message = "Please configure the memcache settings in inc/config.php before attempting to use this cache handler";
$error_handler->trigger($message, MYBB_CACHEHANDLER_LOAD_ERROR);
die;

Zeile 89Zeile 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->memcache->get($this->unique_id."_".$name);


	{
$data = $this->memcache->get($this->unique_id."_".$name);


Zeile 107Zeile 109
		{
return $data;
}

		{
return $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 124Zeile 126
	/**
* 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 boolean True on success, false on failure
*/
function delete($name)

Zeile 140Zeile 142
		@$this->memcache->close();
}


		@$this->memcache->close();
}


	function size_of($name)






	/**
* @param string $name
*
* @return string
*/
function size_of($name='')

	{
global $lang;


	{
global $lang;