Vergleich inc/cachehandlers/apc.php - 1.8.1 - 1.8.9

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

/**
* APC Cache Handler
*/

class apcCacheHandler

class apcCacheHandler 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 __construct($silent=false)

	function __construct()

	{
global $mybb;


	{
global $mybb;


Zeile 31Zeile 33
				$mybb->trigger_generic_error("apc_load_error");
die;
}

				$mybb->trigger_generic_error("apc_load_error");
die;
}

		}

return false;
}


		}
}




	/**
* Connect and initialize this handler.
*

	/**
* Connect and initialize this handler.
*

Zeile 43Zeile 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);


Zeile 54Zeile 52
	/**
* Connect and initialize this handler.
*

	/**
* Connect and initialize this handler.
*

 
	 * @param string $name

	 * @return boolean True if successful, false on failure
*/

	 * @return boolean True if successful, false on failure
*/

	function fetch($name, $hard_refresh=false)

	function fetch($name)

	{
if(apc_exists($this->unique_id."_".$name))
{
$data = apc_fetch($this->unique_id."_".$name);

	{
if(apc_exists($this->unique_id."_".$name))
{
$data = apc_fetch($this->unique_id."_".$name);

			return my_unserialize($data);

			return unserialize($data);

		}

return false;

		}

return false;

	}


	}


	/**
* 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)
{
$status = apc_store($this->unique_id."_".$name, serialize($contents));
return $status;

	 * @return boolean True on success, false on failure
*/
function put($name, $contents)
{
$status = apc_store($this->unique_id."_".$name, serialize($contents));
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 apc_delete($this->unique_id."_".$name);

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