xcache 缓存api函数,可以直接在php中使用

作者:小鱼的互联网观察 发布时间:June 2, 2016 分类:互联网观察

数据函数(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)

//返回值:为数组:

  1. array(16) {
  2.   ["slots"]=>   //slots值
  3.   int(65536)
  4.   ["compiling"]=>
  5.   int(0)
  6.   ["misses"]=>  //失误
  7.   int(0)
  8.   ["hits"]=>   //命中
  9.   int(0)
  10.   ["clogs"]=>  
  11.   int(0)
  12.   ["ooms"]=>
  13.   int(1)
  14.   ["errors"]=>  //错误
  15.   int(0)
  16.   ["cached"]=>  //缓存
  17.   int(78)
  18.   ["deleted"]=>  //
  19.   int(0)
  20.   ["gc"]=>
  21.   int(6)
  22.   ["hits_by_hour"]=>  //最近24小时的命中数
  23.   array(24) {
  24.     [0]=>
  25.     int(0)
  26.     [1]=>
  27.     int(0)
  28.     [2]=>
  29.     int(0)
  30.     [3]=>
  31.     int(0)
  32.     [4]=>
  33.     int(0)
  34.     [5]=>
  35.     int(0)
  36.     [6]=>
  37.     int(0)
  38.     [7]=>
  39.     int(0)
  40.     [8]=>
  41.     int(0)
  42.     [9]=>
  43.     int(0)
  44.     [10]=>
  45.     int(0)
  46.     [11]=>
  47.     int(0)
  48.     [12]=>
  49.     int(0)
  50.     [13]=>
  51.     int(0)
  52.     [14]=>
  53.     int(0)
  54.     [15]=>
  55.     int(0)
  56.     [16]=>
  57.     int(0)
  58.     [17]=>
  59.     int(0)
  60.     [18]=>
  61.     int(0)
  62.     [19]=>
  63.     int(0)
  64.     [20]=>
  65.     int(0)
  66.     [21]=>
  67.     int(0)
  68.     [22]=>
  69.     int(0)
  70.     [23]=>
  71.     int(0)
  72.   }
  73.   ["hits_by_second"]=>  //最近5秒钟的命中数
  74.   array(5) {
  75.     [0]=>
  76.     int(0)
  77.     [1]=>
  78.     int(0)
  79.     [2]=>
  80.     int(0)
  81.     [3]=>
  82.     int(0)
  83.     [4]=>
  84.     int(0)
  85.   }
  86.   ["size"]=>     //共享内存大小,仅此count的,不是所有
  87.   int(134217728)
  88.   ["avail"]=>    //可用内存大小
  89.   int(125642656)
  90.   ["can_readonly"]=>
  91.   bool(false)
  92.   ["free_blocks"]=>
  93.   array(1) {
  94.     [0]=>
  95.     array(2) {
  96.       ["size"]=>   //空闲块链首
  97.       int(125642656)
  98.       ["offset"]=>
  99.       int(8575064)
  100.     }
  101.   }
  102. }



array xcache_list(int type, int id)

//返回值:

  1. array(2) {
  2.   ["cache_list"]=> //缓存列表
  3.  array(78) {
  4.     [0]=>
  5.     array(7) {
  6.       ["size"]=>  //大小
  7.       int(107952)
  8.       ["refcount"]=> //引用次数
  9.       int(0)
  10.       ["hits"]=>     //命中次数
  11.       int(0)
  12.       ["ctime"]=>     //创建时间
  13.       int(1306710407)
  14.       ["atime"]=>     //存在时间
  15.       int(1306710407)
  16.       ["hvalue"]=>
  17.       int(1257)
  18.       ["name"]=>     //名称
  19.       string(9) "my_var100"
  20.     }
  21.     [1]=> ......

  22.  ["deleted_list"]=> //删除列表
  23.   array(0) {
  24.   }
  25. }



void xcache_clear_cache(int type, int id) 

string xcache_coredump(int op_type)

标签: xcache 缓存api函数

互联网观察
xcache 缓存api函数,可以直接在php中使用
本文地址:http://www.tianmeng.org/archives/428/

相关文章

  • 无相关文章
文档信息

当前暂无评论 »

网站地图 京ICP证030173号