【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:CacheXcache.class.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP
// +----------------------------------------------------------------------
// | Copyright (c) 2008 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id$
/**
+------------------------------------------------------------------------------
* Xcache缂撳瓨绫?
+------------------------------------------------------------------------------
* @category Think
* @package Think
* @subpackage Util
* @author liu21st <liu21st@gmail.com>
* @version $Id$
+------------------------------------------------------------------------------
*/
class CacheXcache extends Cache
{
/**
+----------------------------------------------------------
* 鏋舵瀯鍑芥暟
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
*/
public function __construct($options='')
{
if ( !function_exists('xcache_info') ) {
throw_exception(L('绯荤粺涓嶆敮鎸乆cache'));
}
$this->type = strtoupper(substr(__CLASS__,6));
$this->expire = isset($options['expire'])?$options['expire']:C('DATA_CACHE_TIME');
}
/**
+----------------------------------------------------------
* 璇诲彇缂撳瓨
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $name 缂撳瓨鍙橀噺鍚?
+----------------------------------------------------------
* @return mixed
+----------------------------------------------------------
*/
public function get($name)
{
$this->Q(1);
if (xcache_isset($name)) {
return xcache_get($name);
}
return false;
}
/**
+----------------------------------------------------------
* 鍐欏叆缂撳瓨
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $name 缂撳瓨鍙橀噺鍚?
* @param mixed $value 瀛樺偍鏁版嵁
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
*/
public function set($name, $value,$expire='')
{
$this->W(1);
if(empty($expire)) {
$expire = $this->expire ;
}
return xcache_set($name, $value, $expire);
}
/**
+----------------------------------------------------------
* 鍒犻櫎缂撳瓨
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $name 缂撳瓨鍙橀噺鍚?
+----------------------------------------------------------
* @return boolen
+----------------------------------------------------------
*/
public function rm($name)
{
return xcache_unset($name);
}
}//绫诲畾涔夌粨鏉?
?>