php遍历memcache所有键值
很有用的东东,PHP遍历MEMCACHE的所有键,在做管理memcache的时候会用到。
??????
$items=$this->memcache->getExtendedStats
('items');???????
???
???
$items=$items["127.0.0.1:11211"]['items'];
???
???
foreach($items as $key=>$values)
???
???
{???
???
???
???
$number=$key;???
???
???
???
???
$str=$this->memcache->getExtendedStats
("cachedump",$number,0);???
???
???
???
???
$line=$str["127.0.0.1:11211"];???????????
???
???
???
???
??? if(
is_array($line) &&
count($line)>0)
???????????
{???
???
???
???
???
????
???
???
???
foreach($line as $key=>$value)
???
???
???
???
{??????????????????
????????????????????
$array[$key] =
$value[1];?????????????????
???
???
???
??? }
???????????
}
??????
}
上面取到的是其键和该键的生成时间,键的过期时间好像取不到,找了很多地方,都没有说到该如何取键。