6月 212011
 

二、函数说明:

1、数据函数(http://xcache.lighttpd.net/wiki/XcacheApi)
mixed xcache_get(string name)
bool xcache_set(string name, mixed value [, int ttl])
bool xcache_isset(string name)
bool xcache_unset(string name)
bool xcache_unset_by_prefix(string prefix)
//低版本没有这个函数,使用之前要测试一下

int xcache_inc(string name [, int value [, int ttl]])
//自增函数,value为步长,如果没有初始化,则默认为零,ttl为过期时间

int xcache_dec(string name [, int value [, int ttl]])
//自减函数,同上

注意:xcache不能存放对象、资源等内容。

2、管理函数:
int xcache_count(int type)
//type值定义为宏,返回值为把指定的共享内存分为多少份,见xcache.count配置参数
XC_TYPE_PHP: Cache Type = php opcode XC_TYPE_VAR: Cache Type = variable data array xcache_info(int type, int id)
//返回值:为数组:

array(16) {
[“slots”]=> //slots值
int(65536)
[“compiling”]=>
int(0)
[“misses”]=> //失误
int(0)
[“hits”]=> //命中
int(0)
[“clogs”]=>
int(0)
[“ooms”]=>
int(1)
[“errors”]=> //错误
int(0)
[“cached”]=> //缓存
int(78)
[“deleted”]=> //
int(0)
[“gc”]=>
int(6)
[“hits_by_hour”]=> //最近24小时的命中数
array(24) {
[0]=>
int(0)
[1]=>
int(0)
[2]=>
int(0)
[3]=>
int(0)
[4]=>
int(0)
[5]=>
int(0)
[6]=>
int(0)
[7]=>
int(0)
[8]=>
int(0)
[9]=>
int(0)
[10]=>
int(0)
[11]=>
int(0)
[12]=>
int(0)
[13]=>
int(0)
[14]=>
int(0)
[15]=>
int(0)
[16]=>
int(0)
[17]=>
int(0)
[18]=>
int(0)
[19]=>
int(0)
[20]=>
int(0)
[21]=>
int(0)
[22]=>
int(0)
[23]=>
int(0)
}
[“hits_by_second”]=> //最近5秒钟的命中数
array(5) {
[0]=>
int(0)
[1]=>
int(0)
[2]=>
int(0)
[3]=>
int(0)
[4]=>
int(0)
}
[“size”]=> //共享内存大小,仅此count的,不是所有
int(134217728)
[“avail”]=> //可用内存大小
int(125642656)
[“can_readonly”]=>
bool(false)
[“free_blocks”]=>
array(1) {
[0]=>
array(2) {
[“size”]=> //空闲块链首
int(125642656)
[“offset”]=>
int(8575064)
}
}
}

array xcache_list(int type, int id)
//返回值:

array(2) {
[“cache_list”]=> //缓存列表
array(78) {
[0]=>
array(7) {
[“size”]=> //大小
int(107952)
[“refcount”]=> //引用次数
int(0)
[“hits”]=> //命中次数
int(0)
[“ctime”]=> //创建时间
int(1306710407)
[“atime”]=> //存在时间
int(1306710407)
[“hvalue”]=>
int(1257)
[“name”]=> //名称
string(9) “my_var100”
}
[1]=> ……

[“deleted_list”]=> //删除列表
array(0) {
}
}

void xcache_clear_cache(int type, int id)
string xcache_coredump(int op_type)

 回复

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>