php遍历memcache的方法

 1 <?php
 2 
 3 $host='127.0.0.1';
 4 
 5 $port=11211;
 6 
 7 $mem=new Memcache();
 8 
 9 $mem->connect($host,$port);
10 
11 $items=$mem->getExtendedStats (‘items’);
12 
13 $items=$items["$host:$port"]['items'];
14 
15 foreach($items as $key=>$values){
16 
17 $number=$key;;
18 
19 $str=$mem->getExtendedStats ("cachedump",$number,0);
20 
21 $line=$str["$host:$port"];
22 
23 if( is_array($line) && count($line)>0){
24 
25 foreach($line as $key=>$value){
26 
27 echo $key.'=>';
28 
29 print_r($mem->get($key));
30 
31 echo "\r\n";
32 
33 }
34 
35 }
36 }
37 ?>
原文地址:https://www.cnblogs.com/daly2008/p/2769770.html