memcached笔记

启动memcached:./memcached -d -m 10 -l 127.0.0.1 -p 11211 -u root

连接memcached:telnet 127.0.0.1 11211

查看memcached所有key:stats items

结果:

  STAT items:16:number 1
  STAT items:16:age 195
  STAT items:16:evicted 0
  STAT items:16:evicted_nonzero 0
  STAT items:16:evicted_time 0
  STAT items:16:outofmemory 0
  STAT items:16:tailrepairs 0
  STAT items:16:reclaimed 0
  STAT items:16:expired_unfetched 0
  STAT items:16:evicted_unfetched 0

stats cachedump 16 0    (注:16:items id, 0:列出的长度,0为全部列出)

结果:

  ITEM menuList:menu [2333 b; 1406639276 s]
  END
  (注:menuList:menu 为key)

查看数据:get key

get menuList:menu

结果:

VALUE menuList:menu 8 2333
{"v":{"java.util.ArrayList":[{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":1,"menuName":"首页","menuComment":"首页","parentId":-1,"orderMenu":1,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":2,"menuName":"事务","menuComment":"事务","parentId":-1,"orderMenu":2,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":3,"menuName":"日志","menuComment":"日志","parentId":-1,"orderMenu":3,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":4,"menuName":"用户","menuComment":"用户","parentId":-1,"orderMenu":4,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":5,"menuName":"事务1","menuComment":"事务1","parentId":2,"orderMenu":1,"initUrl":"url","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":6,"menuName":"事务2","menuComment":"事务2","parentId":2,"orderMenu":2,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":7,"menuName":"日志1","menuComment":"日志1","parentId":3,"orderMenu":1,"initUrl":"","pathUrl":"","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":8,"menuName":"事务1_1","menuComment":"事务1_1","parentId":5,"orderMenu":1,"initUrl":" ","pathUrl":" ","active":"Y","children":0}},{"com.brin.util.model.menu.MenuVO":{"pageSize":10,"totalRows":0,"curPage":1,"start":0,"end":10,"sord":null,"totalPages":0,"id":9,"menuName":"首页1","menuComment":"首页1","parentId":1,"orderMenu":1,"initUrl":" ","pathUrl":" ","active":"Y","children":0}}]}}
END

memcached笔记,布布扣,bubuko.com

时间: 2024-10-12 17:32:41

memcached笔记的相关文章

Memcached 笔记与总结(7)增加虚拟节点

仅仅把 Memcached 服务器集群地址通过一致性哈希转映射在圆环上,可能会出现数据不能均匀地分配给各台 Memcached 服务器. 解决方案是引入虚拟节点,就是把每个映射在圆环上的服务器地址(物理节点)转变成更多的(注:关于虚拟节点的个数参考①)虚拟节点. 修改 Memcached 笔记与总结(6)PHP 实现 Memcached 的一致性哈希分布算法 中的代码: 类 consistentHash 增加私有的成员属性:$position,以键值形式保存所有虚拟节点的哈希值(键)和对应的服务

Memcached笔记——(一)安装&常规错误&监控

08年的时候接触过Memcached,当时还对它的客户端产品嗤之以鼻,毕竟手工代码没有各种ORM原生XML配置方便.尽管如此,Memcached现在已经成了服务器架构里不可或缺的一部分! 相关链接: Memcached笔记——(一)安装&常规错误&监控Memcached笔记——(二)XMemcached&Spring集成 Memcached笔记——(三)Memcached使用总结 Memcached笔记——(四)应对高并发攻击  一.下载 1.Libevent 简单的说就是一个事件

Memcached笔记——(四)应对高并发攻击

近半个月过得很痛苦,主要是产品上线后,引来无数机器用户恶意攻击,不停的刷新产品各个服务入口,制造垃圾数据,消耗资源.他们的最好成绩,1秒钟可以并发6次,赶在Database入库前,Cache进行Missing Loading前,强占这其中十几毫秒的时间,进行恶意攻击. 相关链接: Memcached笔记——(一)安装&常规错误&监控Memcached笔记——(二)XMemcached&Spring集成 Memcached笔记——(三)Memcached使用总结  Memcached

Memcached笔记——(二)XMemcached&Spring集成

今天研究Memcached的Java的Client,使用XMemcached 1.3.5,做个简单的测试,并介绍如何与Spring集成. 相关链接: Memcached笔记——(一)安装&常规错误&监控Memcached笔记——(二)XMemcached&Spring集成 Memcached笔记——(三)Memcached使用总结 Memcached笔记——(四)应对高并发攻击  一.Memcached Client简要介绍 Memcached Client目前有3种: Memca

Memcached笔记——(三)Memcached使用总结

为了将N个前端数据同步,通过Memcached完成数据打通,但带来了一些新问题: 使用iBatis整合了Memcached,iBatis针对每台server生成了唯一标识,导致同一份数据sql会产生不同的key,造成重复缓存.——通过重写iBatis部分原码,终止了唯一标识的生成,同一个SQL产生同一个Key,同时对生成key做hash,控制长度,使得数据统一在Memcached. 为了迎合iBatis的架构,通过CacheModel模式,对缓存数据分组管理.最初通过Map实现CacheMode

memcached 笔记之windows 7 下面 安装memcached 报错

windows 7 下面 安装memcached 报错 两种情况: 一:服务确实已经安装过 .如需要重新安装,当然是先memcached.exe -d uninstall 二:奇怪的是服务确实没有安装过的情况,在memcached.exe -d install也会出现上面定位报错.此时关掉cmd窗口  然后以管理员身份运行cmd,在执行上面的install,不出意外你会顺利的执行成功. 常用命令: 安装.卸载.启动.配置相关 -p 监听的端口 -l 连接的IP地址, 默认是本机 -d start

Memcached笔记——(四)应对高并发攻击【转】

http://snowolf.iteye.com/blog/1677495 近半个月过得很痛苦,主要是产品上线后,引来无数机器用户恶意攻击,不停的刷新产品各个服务入口,制造垃圾数据,消耗资源.他们的最好成绩,1秒钟可以并发6次,赶在Database入库前,Cache进行Missing Loading前,强占这其中十几毫秒的时间,进行恶意攻击. 相关链接: Memcached笔记——(一)安装&常规错误&监控Memcached笔记——(二)XMemcached&Spring集成 Me

Memcached 笔记与总结(4)memcache 扩展的使用

在 wamp 环境下进行测试:WAMPSERVER 2.2(Windows 7 + Apache 2.2.21 + PHP 5.3.10 + memcache 3.0.8 + Memcached 1.4.24) 在本地开启 Memcached 服务: 简单例子: <?php //创建Memcache对象 $mc = new Memcache(); //连接Memcached服务器 $mc->connect('127.0.0.1', 11211); //存储数据 $mc->set('nam

Memcached 笔记与总结(3)安装 php-memcache(windows 系统下)

在 windows 下安装 php-memcache,需要下载编译好的 memcached.dll. 要找到可用的 dll 文件,需要根据 php.ini 中的 3 个参数来选择 dll 文件: ① Compiler:当前 windows 下的 php 的编译器(这里是 MSVC9 (Visual C++ 2008)) ② PHP Version:当前 php 的版本(这里是 5.3.10) 在测试页输出 phpinfo: ③ PHP Extension Build:php 的扩展的编译(这里是