Spring RedisTemplate操作-序列化性能测试(12)
@Autowired
@Qualifier("redisTemplate")
private RedisTemplate<String, String> stringredisTemplate; @Autowired
@Qualifier("jdkredisTemplate")
private RedisTemplate<Object, Object> jdkredisTemplate; @Autowired
@Qualifier("jacksonredisTemplate")
private RedisTemplate<Object, Object> jacksonredisTemplate; public void flushdb(){
stringredisTemplate.execute(new RedisCallback<Object>() {
public String doInRedis(RedisConnection connection) throws DataAccessException {
connection.flushDb();
return "ok";
}
});
}
@Test
public void test(){
flushdb(); StopWatch sw = new StopWatch("StringRedisSerializer");
sw.start("stringredisTemplate");
for(int i = 0;i<100;i++){
stringredisTemplate.opsForValue().set("hello", "nihao");
stringredisTemplate.opsForValue().get("hello");
}
sw.stop(); sw.start("jdkredisTemplate");
for(int i = 0;i<100;i++){
User u = new User();
jdkredisTemplate.opsForValue().set("hello", u);
jdkredisTemplate.opsForValue().get(u);
}
sw.stop(); sw.start("jacksonredisTemplate");
for(int i = 0;i<100;i++){
User u = new User();
jacksonredisTemplate.opsForValue().set("hello", u);
jacksonredisTemplate.opsForValue().get(u);
}
sw.stop(); System.out.println(sw.prettyPrint()); }
Spring RedisTemplate操作-序列化性能测试(12)的更多相关文章
- Spring RedisTemplate操作-xml配置(1)
网上没能找到全的spring redistemplate操作例子,故特意化了点时间做了接口调用练习,基本包含了所有redistemplate方法. 该操作例子是个系列,该片为spring xml配置, ...
- Spring RedisTemplate操作-发布订阅操作(8)
@Component("sub") public class Sub implements MessageListener{ @Autowired private StringRe ...
- Spring RedisTemplate操作-事务操作(9)
@Autowired @Qualifier("redisTemplate") private RedisTemplate<String, String> stringr ...
- Spring RedisTemplate操作-通道操作(10)
@Autowired @Resource(name = "redisTemplate") private RedisTemplate<String, String> r ...
- Spring RedisTemplate操作-HyperLogLog操作(7)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
- Spring RedisTemplate操作-Set操作(5)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
- Spring RedisTemplate操作-ZSet操作(6)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
- Spring RedisTemplate操作-List操作(4)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
- Spring RedisTemplate操作-哈希操作(3)
@Autowired @Resource(name="redisTemplate") private RedisTemplate<String, String> rt; ...
随机推荐
- Laravel 5.5 文档 ] 快速入门 —— 安装配置篇
服务器要求 Laravel 框架对PHP版本和扩展有一定要求,不过这些要求 Laravel Homestead 都已经满足了,不过如果你没有使用 Homestead 的话(那真是一件很遗憾的事情),有 ...
- [转帖]2016年时的新闻:ASP.NET Core 1.0、ASP.NET MVC Core 1.0和Entity Framework Core 1.0
ASP.NET Core 1.0.ASP.NET MVC Core 1.0和Entity Framework Core 1.0 http://www.cnblogs.com/webapi/p/5673 ...
- [转帖] infiniband的协议速度
- [转帖]DevOps/TestOps概念
发现收藏不好用..还是转吧.. https://www.cnblogs.com/fnng/p/8232410.html DevOps/TestOps概念 2018-01-07 22:02 by 虫师, ...
- Node buffer模块缓冲区
//1:字节 byte//1024b = 1kb [千字节]//1024kb = 1mb [兆字节]//1024mb = 1gb [吉字节]//1024gb = 1tb [梯]//1024tb = 1 ...
- python slots
正常情况下,当我们定义了一个class,创建了一个class的实例后,我们可以给该实例绑定任何属性和方法,这就是动态语言的灵活性.先定义class: >>> class Studen ...
- CAS登陆过程UML中文版
如果大家图片显示看不请,可以点击图片右键:在新窗口中打开图片,进行查看 名词解释 CASTGC:向cookie中添加该值的目的是当下次访问 认证中心 时,浏览器将Cookie中的TGC携带到服务器,服 ...
- html 響應式web設計
RWD(響應式web設計)可以根據尺寸大小傳遞網頁,對於平板和移動設備是必須的. <html lang="en-US"> lang表示頁面的主要語言.http://ww ...
- Hibernate表关系03
一. 一对多映射 1.基本应用 1.1 准备项目 创建项目:hibernate-02-relation 引入jar,同前一个项目 复制实体(客户).映射.配置.工具类 1.2 创建订单表 表名: t_ ...
- Codeforces Round #419 (Div. 2) B. Karen and Coffee
To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, want ...