ThinkPHP5


think\cache\driver\Memcached
library\think\cache\driver\Memcached.php at line 16

Class Memcached

Driver
└─Memcached

public class Memcached
extends Driver

缓存基础类


Constructor Summary
void

__construct(array options)

架构函数

Method Summary
bool

has(string name)

判断缓存

mixed

get(string name, mixed default)

读取缓存

bool

set(string name, mixed value, integer expire)

写入缓存

false|int

inc(string name, int step)

自增缓存(针对数值缓存)

false|int

dec(string name, int step)

自减缓存(针对数值缓存)

bool

rm(string name, bool|false ttl)

删除缓存

bool

clear(string tag)

清除缓存

Methods inherited from think\cache\Driver
clear, dec, get, getCacheKey, getTagItem, handler, has, inc, pull, rm, set, setTagItem, tag

Constructor Detail

library\think\cache\driver\Memcached.php at line 25

__construct

public void __construct(array options)

架构函数

Parameters:
options - 缓存参数

Method Detail

library\think\cache\driver\Memcached.php at line 65

has

public bool has(string name)

判断缓存

Parameters:
name - 缓存变量名

library\think\cache\driver\Memcached.php at line 78

get

public mixed get(string name, mixed default)

读取缓存

Parameters:
name - 缓存变量名
default - 默认值

library\think\cache\driver\Memcached.php at line 92

set

public bool set(string name, mixed value, integer expire)

写入缓存

Parameters:
name - 缓存变量名
value - 存储数据
expire - 有效时间(秒)

library\think\cache\driver\Memcached.php at line 116

inc

public false|int inc(string name, int step)

自增缓存(针对数值缓存)

Parameters:
name - 缓存变量名
step - 步长

library\think\cache\driver\Memcached.php at line 129

dec

public false|int dec(string name, int step)

自减缓存(针对数值缓存)

Parameters:
name - 缓存变量名
step - 步长

library\think\cache\driver\Memcached.php at line 147

rm

public bool rm(string name, bool|false ttl)

删除缓存

Parameters:
name - 缓存变量名

library\think\cache\driver\Memcached.php at line 161

clear

public bool clear(string tag)

清除缓存

Parameters:
tag - 标签名

ThinkPHP5