PHP 클래스 CacheModel, thinksns

파일 보기 프로젝트 열기: medz/thinksns-4 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$handler public static $_cacheHash = array(); // 缓存的静态变量
$type 操作句柄

공개 메소드들

메소드 설명
Q ( ) : 获取缓存的读取次数 缓存读取次数
W ( ) : 获取缓存写入次数 缓存写入次数
__construct ( $type = '' ) 初始化缓存模型对象,缓存类型
clear ( ) : boolen 清除缓存
get ( string $_key, boolean $mutex = false ) : mix 获取缓存操作,支持mutex模式 mutex使用注意 1.设置缓存(set)时,需要设置有效时间 2.获取缓存(get)时,需要主动创建缓存
getList ( string $prefix, string $key ) : mix 根据某个前缀,批量获取多个缓存
rm ( string $_key ) : boolean 删除缓存
set ( string $key, mix $value, $expire = null ) 设置缓存
setType ( string $type ) : object 链式设置缓存类型

비공개 메소드들

메소드 설명
_returnData ( mix $data, string $key ) : mix 返回缓存数据操作,方法中,将数据缓存到静态缓存中

메소드 상세

Q() 공개 메소드

缓存读取次数
public Q ( ) : 获取缓存的读取次数
리턴 获取缓存的读取次数

W() 공개 메소드

缓存写入次数
public W ( ) : 获取缓存写入次数
리턴 获取缓存写入次数

__construct() 공개 메소드

初始化缓存模型对象,缓存类型
public __construct ( $type = '' )

clear() 공개 메소드

清除缓存
public clear ( ) : boolen
리턴 boolen

get() 공개 메소드

获取缓存操作,支持mutex模式 mutex使用注意 1.设置缓存(set)时,需要设置有效时间 2.获取缓存(get)时,需要主动创建缓存
public get ( string $_key, boolean $mutex = false ) : mix
$_key string 缓存Key值
$mutex boolean 是否启用mutex模式,默认为不启用
리턴 mix 缓存数据

getList() 공개 메소드

根据某个前缀,批量获取多个缓存
public getList ( string $prefix, string $key ) : mix
$prefix string 缓存前缀
$key string 缓存Key值
리턴 mix 缓存数据

rm() 공개 메소드

删除缓存
public rm ( string $_key ) : boolean
$_key string 缓存Key值
리턴 boolean 是否删除成功

set() 공개 메소드

设置缓存
public set ( string $key, mix $value, $expire = null )
$key string 缓存Key值
$value mix 缓存Value值

setType() 공개 메소드

链式设置缓存类型
public setType ( string $type ) : object
$type string 缓存类型
리턴 object 缓存模型对象

프로퍼티 상세

$handler 보호되어 있는 프로퍼티

public static $_cacheHash = array(); // 缓存的静态变量
protected $handler

$type 보호되어 있는 프로퍼티

操作句柄
protected $type