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; ...
随机推荐
- VC6到VC2010,项目迁移错误
错误信息: error C2440: “static_cast”: cannot from “BOOL (__thiscall CSelectRect::* )(void)” to “BOOL (__ ...
- Java Date Compare
Date a;Date b;假设现在你已经实例化了a和ba.after(b)返回一个boolean,如果a的时间在b之后(不包括等于)返回true b.before(a)返回一个boolean,如果b ...
- ODBC 驱动程序管理器 在指定的 DSN 中,驱动程序和应用程序之间的体系结构不匹配 解决方案
程序报错如下: ---------------------------Microsoft 数据链接错误---------------------------测试连接失败,因为初始化提供程序时发生错误. ...
- Array与Object
typeof([ ])的返回值是object,因为数组叫做数组对象. Array有length属性,而Object没有length属性,所以可以根据length属性来判断数据属于数组还是对象. Arr ...
- hive 远程管理
- SpringBoot(十七)_springboot跨域处理
本文转自:Vi的技术博客 什么是跨域 首先,我们需要了解一下一个URL是怎么组成的: // 协议 + 域名(子域名 + 主域名) + 端口号 + 资源地址 http: + // + www.baidu ...
- 【转载】JAVA消息服务JMS规范及原理详解
转载:https://www.cnblogs.com/molao-doing/articles/6557305.html 作者: moyun- 一.简介 JMS即Java消息服务(Java Messa ...
- 科普一下bl锁的知识,没解锁的必看!
今天给大家科普一下. 科普分为两版,一个详细版一个简单版.简单版往下翻. bl是什么?其实详细的我也不知道,我就知道原理和他的全称是bootloader.我们所说的解锁里面的“锁”,就是blbl锁的功 ...
- MVC 多语言
最近项目需要用到多语言. 研究了一下,也参考了很多技术文章. 这里贴一下参考地址:http://www.cnblogs.com/unintersky/p/3969612.html 主要步骤我这里简述一 ...
- Colored Sticks POJ - 2513(trie树欧拉路)
题意: 就是无向图欧拉路 解析: 不能用map..超时 在判断是否只有一个联通的时候,我比较喜欢用set,但也不能用set,会超时,反正不能用stl emm 用trie树来编号就好了 #include ...