php遍历memcached中所有数据的方法
折叠 展开 PHP Code 复制内容到剪贴板 ?php $host = '192.168.15.225' ; $port =11211; $mem = new Memcache(); $mem -connect( $host , $port ); $items = $mem -getExtendedStats( 'items' ); $items = $items [ $host:$port ][ 'items' ]; for
折叠展开PHP Code复制内容到剪贴板
- <?php
- $host='192.168.15.225';
- $port=11211;
- $mem=new Memcache();
- $mem->connect($host,$port);
- $items=$mem->getExtendedStats ('items');
- $items=$items["$host:$port"]['items'];
- foreach($items as $key=>$values)
- {
- $number=$key;;
- $str=$mem->getExtendedStats ("cachedump",$number,0);
- $line=$str["$host:$port"];
- if( is_array($line) && count($line)>0){
- foreach($line as $key=>$value){
- echo $key.'=>';
- print_r($mem->get($key));
- echo "rn";
- }
- }
- }
- ?>
精彩图集
精彩文章