PHP Class Jenner\SimpleFork\Cache\FileCache

Inheritance: implements Jenner\SimpleFork\Cache\CacheInterface
显示文件 Open project: huyanping/simple-fork-php

Public Methods

Method Description
__construct ( string $cache_dir )
decrement ( $key, integer $value = 1 ) : mixed 减法递增
delTree ( $dir ) : boolean 递归删除目录
delete ( $key ) : boolean 删除一个key,同事会删除缓存文件
flush ( ) : mixed 清楚所有缓存
get ( string $key, string $default = null ) : mixed get value by key, and check if it is expired
has ( $key ) : mixed 判断Key是否存在
increment ( $key, integer $value = 1 ) : mixed 加法递增
set ( string $key, mixed $value, integer $expire ) : mixed 添加或覆盖一个key

Protected Methods

Method Description
checkExpire ( $cache_data ) : boolean 检查key是否过期
getItem ( $key ) : boolean | mixed | string 获取含有元数据的信息
path ( string $key ) : string 根据key获取缓存文件路径

Private Methods

Method Description
createCacheFile ( $key ) : boolean | string 创建缓存文件
setItem ( $key, $value, $time, $expire ) : boolean 设置包含元数据的信息

Method Details

__construct() public method

public __construct ( string $cache_dir )
$cache_dir string

checkExpire() protected method

检查key是否过期
protected checkExpire ( $cache_data ) : boolean
$cache_data
return boolean

decrement() public method

减法递增
public decrement ( $key, integer $value = 1 ) : mixed
$key
$value integer
return mixed

delTree() public method

递归删除目录
public delTree ( $dir ) : boolean
$dir
return boolean

delete() public method

删除一个key,同事会删除缓存文件
public delete ( $key ) : boolean
$key
return boolean

flush() public method

清楚所有缓存
public flush ( ) : mixed
return mixed

get() public method

get value by key, and check if it is expired
public get ( string $key, string $default = null ) : mixed
$key string
$default string
return mixed

getItem() protected method

获取含有元数据的信息
protected getItem ( $key ) : boolean | mixed | string
$key
return boolean | mixed | string

has() public method

判断Key是否存在
public has ( $key ) : mixed
$key
return mixed

increment() public method

加法递增
public increment ( $key, integer $value = 1 ) : mixed
$key
$value integer
return mixed

path() protected method

根据key获取缓存文件路径
protected path ( string $key ) : string
$key string
return string

set() public method

添加或覆盖一个key
public set ( string $key, mixed $value, integer $expire ) : mixed
$key string
$value mixed
$expire integer expire time in seconds
return mixed