redis批量get和set
//批量set数据redisTemplate.executePipelined(new RedisCallback<String>() {@Overridepublic String doInRedis(RedisConnection connection) throws DataAccessException {for (int i=0;i<list..
·
//批量set数据
redisTemplate.executePipelined(new RedisCallback<String>() {
@Override
public String doInRedis(RedisConnection connection) throws DataAccessException {
for (int i=0;i<list.size();i++) {
connection.set(("test"+(startcount*(Integer.valueOf(map.get("limit").toString()))+i)).getBytes(),list.get(i).toString().getBytes());
}
return null;
}
});
//批量get将set换成get即可,startcount、和map是在该方法外的数据
更多推荐
已为社区贡献5条内容
所有评论(0)