1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
@Service public class PipelineService { @Autowired private RedisTemplate<String, Object> redisTemplate;
public void pipeline() { redisTemplate.executePipelined((RedisCallback<String>) connection -> { for (int i = 0; i < 100; i++) { connection.set(("pipeline:" + i).getBytes(), "123".getBytes()); } return null; }); }
public void common() { for (int i = 0; i < 100; i++) { redisTemplate.opsForValue().set("common:" + i, "123"); } } }
|