Vergleich inc/cachehandlers/memcache.php - 1.6.10 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: memcache.php 5297 2010-12-28 22:01:14Z Tomm $

 * $Id$

 */

/**

 */

/**

Zeile 23Zeile 23
	 * Unique identifier representing this copy of MyBB
*/
public $unique_id;

	 * Unique identifier representing this copy of MyBB
*/
public $unique_id;

	



	function memcacheCacheHandler($silent=false)
{
global $mybb;

	function memcacheCacheHandler($silent=false)
{
global $mybb;

		



		if(!function_exists("memcache_connect"))
{
// Check if our DB engine is loaded

		if(!function_exists("memcache_connect"))
{
// Check if our DB engine is loaded

Zeile 48Zeile 48
	function connect()
{
global $mybb, $error_handler;

	function connect()
{
global $mybb, $error_handler;

		



		$this->memcache = new Memcache;

		$this->memcache = new Memcache;

		



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

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

		



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

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

Zeile 67Zeile 67
				die;
}


				die;
}


			if(!$memcache['port'])

			if(!isset($memcache['port']))

			{
$memcache['port'] = "11211";
}

			{
$memcache['port'] = "11211";
}

Zeile 87Zeile 87

return true;
}


return true;
}

	



	/**
* Retrieve an item from the cache.
*

	/**
* Retrieve an item from the cache.
*

Zeile 95Zeile 95
	 * @param boolean True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/

	 * @param boolean True if we should do a hard refresh
* @return mixed Cache data if successful, false if failure
*/

	



	function fetch($name, $hard_refresh=false)
{
$data = $this->memcache->get($this->unique_id."_".$name);

	function fetch($name, $hard_refresh=false)
{
$data = $this->memcache->get($this->unique_id."_".$name);

Zeile 109Zeile 109
			return $data;
}
}

			return $data;
}
}

	



	/**
* Write an item to the cache.
*

	/**
* Write an item to the cache.
*

Zeile 119Zeile 119
	 */
function put($name, $contents)
{

	 */
function put($name, $contents)
{

		return $this->memcache->set($this->unique_id."_".$name, $contents, MEMCACHE_COMPRESSED);

		return $this->memcache->set($this->unique_id."_".$name, $contents);

	}

	}

	



	/**
* Delete a cache
*

	/**
* Delete a cache
*

Zeile 132Zeile 132
	{
return $this->memcache->delete($this->unique_id."_".$name);
}

	{
return $this->memcache->delete($this->unique_id."_".$name);
}

	



	/**
* Disconnect from the cache
*/

	/**
* Disconnect from the cache
*/

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

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

	



	function size_of($name)
{
global $lang;

	function size_of($name)
{
global $lang;

		



		return $lang->na;
}
}

		return $lang->na;
}
}