对memcache的数据(key-value)进行遍历操作
来源:互联网 发布:php解析html 编辑:程序博客网 时间:2024/06/06 01:47
1. PHP实现:
参考资料:http://www.cnblogs.com/sunli/archive/2008/11/01/1324153.html
$port = 11211;$host = '192.168.11.128';$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 "\r\n";}}}
2. Java实现:
import java.io.IOException;import java.net.InetAddress;import java.net.InetSocketAddress;import java.util.Iterator;import java.util.Map;import java.util.Map.Entry;import java.util.concurrent.TimeoutException;import net.rubyeye.xmemcached.KeyIterator;import net.rubyeye.xmemcached.MemcachedClient;import net.rubyeye.xmemcached.XMemcachedClient;import net.rubyeye.xmemcached.exception.MemcachedException;public class XMemcache {public static void main(String[] args) throws IOException, TimeoutException, InterruptedException, MemcachedException {InetAddress addr = InetAddress.getByName("192.168.11.128");InetSocketAddress ia = new InetSocketAddress(addr, 11211);MemcachedClient client = new XMemcachedClient(ia);KeyIterator it = client.getKeyIterator(ia);while(it.hasNext()) {String key = it.next();System.out.println(client.get(key));}client.shutdown();}}
3. Ruby实现:
http://robbin.iteye.com/blog/252345
4. telnet:
http://iamcaihuafeng.blog.sohu.com/159082880.html
特别提醒:http://fnil.net/docs/xmemcached/net/rubyeye/xmemcached/class-use/KeyIterator.html
memcached 1.6.x will remove cachedump stats command,so this method will be removed in the future
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 如何对memcache的数据(key-value)进行遍历操作
- 对memcache的数据(key-value)进行遍历
- 如何对memcache的数据(key-value)进行遍历操作.files
- 遍历Memcache的key
- 程序遍历memcache中的所有key-value
- (key,value)对value进行排序
- STL 对map的key和value进行大小排序
- iOS 对字典的key,value进行排序
- 对Map的key和value进行排序
- 对Map的key和value进行排序
- ATL技术内幕 第一部分
- hdu 12310 girl friend #DP#组合数学
- 微软自带 treeview 绑定数据
- 一致性哈希(Consistent Hashing)的实现
- [转]输入法全角自动转半角的技术处理
- 对memcache的数据(key-value)进行遍历操作
- Linux私房菜基础篇:第二部分,linux文件、目录与磁盘格式
- asp.net二级域名的解析
- 只要有你
- win2008安装 apache+php+mysql
- svn安装
- 二叉树的前序遍历、中序遍历和后序遍历及其算法
- 二叉树遍历(中序,先序,后序,层次等)
- 第一周工作小结