Home >Backend Development >PHP Tutorial > php遍历memcache全部键值

php遍历memcache全部键值

WBOY
WBOYOriginal
2016-06-13 13:08:54992browse

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];?????????????????
??? ??? ??? ??? }
??????????? }
?????? }
上面取到的是其键和该键的生成时间,键的过期时间好像取不到,找了很多地方,都没有说到该如何取键。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article: mysql in 有关问题 Next article: apache重写有关问题