Memcache类
(PECL memcache >= 0.2.0)
简介
表示连接到一个服务器组的连接。
类摘要
class Memcache
{
addServer(
string
int
bool
int
int
int
bool
callback
int
): bool
string
$host
,int
$port
= 11211,bool
$persistent
= ?,int
$weight
= ?,int
$timeout
= ?,int
$retry_interval
= ?,bool
$status
= ?,callback
$failure_callback
= ?,int
$timeoutms
= ?): bool
close(): bool
flush(): bool
getVersion(): string
setServerParams(
string
int
int
int
bool
callback
): bool
}string
$host
,int
$port
= 11211,int
$timeout
= ?,int
$retry_interval
= false,bool
$status
= ?,callback
$failure_callback
= ?): bool
目录
- Memcache::add — 增加一个条目到缓存服务器
- Memcache::addServer — 向连接池中添加一个memcache服务器
- Memcache::close — 关闭memcache连接
- Memcache::connect — 打开一个memcached服务端连接
- Memcache::decrement — 减小元素的值
- Memcache::delete — 从服务端删除一个元素
- Memcache::flush — 清洗(删除)已经存储的所有的元素
- Memcache::get — 从服务端检回一个元素
- Memcache::getExtendedStats — 缓存服务器池中所有服务器统计信息
- Memcache::getServerStatus — 用于获取一个服务器的在线/离线状态
- Memcache::getStats — 获取服务器统计信息
- Memcache::getVersion — 返回服务器版本信息
- Memcache::increment — 增加一个元素的值
- Memcache::pconnect — 打开一个到服务器的持久化连接
- Memcache::replace — 替换已经存在的元素的值
- Memcache::set — Store data at the server
- Memcache::setCompressThreshold — 开启大值自动压缩
- Memcache::setServerParams — 运行时修改服务器参数和状态

User Contributed Notes 1 note
chris at NOSPAM dot xeneco dot co dot uk ¶
9 years ago
It helps to know that for this extension to work, you need a server with 'Memcached' (a service independent of PHP) installed and running as a service.
The documentation herein refers a lot to 'memcache_host'. This is not an arbitrary string, but should be a host name (eg localhost) or an IP address of a server running memcached.
If you have just installed the php memcache extension then you will not necessarily have memcached installed as well