Spring RedisTemplate操作-通道操作(10)

@Autowired
@Resource(name = "redisTemplate")
private RedisTemplate<String, String> rt; public void flushdb() {
rt.execute(new RedisCallback<Object>() {
public String doInRedis(RedisConnection connection) throws DataAccessException {
connection.flushDb();
return "ok";
}
});
} public void set() {
flushdb();
rt.opsForValue().set("a", "1");
List<Object> results = rt.executePipelined(new RedisCallback<Object>() {
public Object doInRedis(RedisConnection connection) throws DataAccessException {
for (int i = 0; i < 10; i++) {
connection.incr("a".getBytes());
}
return null;
}
});
System.out.println(rt.opsForValue().get("a"));
}
上一篇:HTML特殊符号显示技巧


下一篇:swfupload多文件上传[附源码]