2 u011098885 u011098885 于 2016.03.09 09:26 提问

php memcache遍历问题

$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect to memcache server");

$list = array();
$allSlabs = $memcache->getExtendedStats('slabs');
$items = $memcache->getExtendedStats('items');
foreach($allSlabs as $server => $slabs) {
foreach($slabs AS $slabId => $slabMeta) {
$cdump = $memcache->getExtendedStats('cachedump',(int)$slabId);
foreach($cdump AS $keys => $arrVal) {
foreach($arrVal AS $k => $v){
echo $k ."
";
}
}
}
}

我再网上搜到这种遍历key的方法,但是当数据量超过100了以后,第101条开始就不能遍历出来,必须删掉能遍历出来的数据才能显示后面的数据,求大神给个在不删除任何数据的情况下遍历全部的key

1个回答

hnxcjsbzzysljf
hnxcjsbzzysljf   2016.10.08 01:31

php memcache 遍历
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect to memcache server");
$list = array();
$allSlabs = $memcache->getExtendedStats('slabs');
$items = $memcache->getExtendedStats('items');
foreach($allSlabs as $server => $slabs) {
foreach($slabs AS $slabId => $slabMeta) {
$cdump = $memcache->getExtendedStats('cachedump',(int)$slabId);
foreach($cdump AS $keys => $arrVal) {
foreach($arrVal AS $k => $v){
echo $k ."
";
}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!