PHP Class Cml\Cache\File

Inheritance: extends Base
Show file Open project: linhecheng/cmlphp

Public Methods

Method Description
__construct ( $conf = false ) 使用的缓存配置 默认为使用default_cache配置的参数
__construct ( bool|array $conf = false ) 使用的缓存配置 默认为使用default_cache配置的参数
cleanDir ( string $dir ) : boolean 清空文件夹
decrement ( string $key, integer $val = 1 ) : boolean 自减
delete ( string $key ) : boolean 删除缓存
get ( string $key ) : mixed 获取缓存
getInstance ( string $key = '' ) : void 返回实例便于操作未封装的方法
increment ( string $key, integer $val = 1 ) : boolean 自增
set ( string $key, mixed $value, integer $expire ) : boolean 写入缓存
truncate ( ) : boolean 清空缓存
update ( string $key, mixed $value, integer $expire ) : boolean 更新缓存 可以直接用set但是为了一致性操作所以做此兼容

Private Methods

Method Description
getFileName ( string $key ) : string 获取缓存文件名

Method Details

__construct() public method

使用的缓存配置 默认为使用default_cache配置的参数
public __construct ( $conf = false )

__construct() public method

使用的缓存配置 默认为使用default_cache配置的参数
public __construct ( bool|array $conf = false )
$conf bool|array

cleanDir() public method

清空文件夹
public cleanDir ( string $dir ) : boolean
$dir string
return boolean

decrement() public method

自减
public decrement ( string $key, integer $val = 1 ) : boolean
$key string 要自减的缓存的数据的key
$val integer 自减的进步值,默认为1
return boolean

delete() public method

删除缓存
public delete ( string $key ) : boolean
$key string 要删除的数据的key
return boolean

get() public method

获取缓存
public get ( string $key ) : mixed
$key string 要获取的缓存key
return mixed

getInstance() public method

返回实例便于操作未封装的方法
public getInstance ( string $key = '' ) : void
$key string
return void

increment() public method

自增
public increment ( string $key, integer $val = 1 ) : boolean
$key string 要自增的缓存的数据的key
$val integer 自增的进步值,默认为1
return boolean

set() public method

写入缓存
public set ( string $key, mixed $value, integer $expire ) : boolean
$key string key 要缓存的数据的key
$value mixed 要缓存的数据 要缓存的值,除resource类型外的数据类型
$expire integer 缓存的有效时间 0为不过期
return boolean

truncate() public method

清空缓存
public truncate ( ) : boolean
return boolean

update() public method

更新缓存 可以直接用set但是为了一致性操作所以做此兼容
public update ( string $key, mixed $value, integer $expire ) : boolean
$key string 要更新的数据的key
$value mixed 要更新缓存的值,除resource类型外的数据类型
$expire integer 缓存的有效时间 0为不过期
return boolean