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; ...
随机推荐
- mysql 备份数据库 mysqldump
@echo off for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE ...
- ubuntu解压zip文件
step1 # 安装解压软件 sudo apt-get install unzip step # 2 解压文件 unzip xxxxx.zip
- PP模块的主要功能及标准业务流程
主要功能:1.SOP (Sales and operations Planning).2.资源分配计划划 (Distribution Resource Planning)3.生产计划编制 (Produ ...
- ElasticSearch 6.x head插件安装
一.下载node.js yum install -y nodejs 二.安装npm npm install -g cnpm --registry=https://registry.npm.taobao ...
- ItemsControl的两种数据绑定方式
最近在学习ItemsControl这个控件的时候,查看了MSDN上面的一个例子,并且自己做了一些修改,这里主要使用了两种方式来进行相应的数据绑定,一种是使用DataContext,另外一种是直接将一个 ...
- vander范德蒙德行列式
https://baike.baidu.com/item/%E8%8C%83%E5%BE%B7%E8%92%99%E8%A1%8C%E5%88%97%E5%BC%8F function m=vande ...
- 与spring整合就是为了不用自己创建bean 让spring帮助我们创建bean
与spring整合就是为了不用自己创建bean 让spring帮助我们创建bean
- Codeforces Round #417 (Div. 2) C. Sagheer and Nubian Market
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 【转】学习MOS管技术知识,这篇文章就够了!
MOS管学名是场效应管,是金属-氧化物-半导体型场效应管,属于绝缘栅型.本文就结构构造.特点.实用电路等几个方面用工程师的话简单描述. 其结构示意图: 解释1:沟道 上面图中,下边的p型中间一个窄长条 ...
- 【转】C语言中,为什么字符串可以赋值给字符指针变量
本文是通过几篇转帖的文章整理而成的,内容稍有修改: 一. C语言中,为什么字符串可以赋值给字符指针变量 char *p,a='5';p=&a; //显然 ...