when you use spring-data-redis to integrate redis, in a spring project and operate on redis through RedisTemplate, you want to package some operations of multiple redistemplate so that other Redis operations may not be inserted.
public class Test {
@Resource
RedisTemplate<String, A> classARedisTemplate;
@Resource
RedisTemplate<String, B> classBRedisTemplate;;
//,Redisredis
public void transaction(){
A a = new A();
classARedisTemplate.opsForValue().set("keyA", a);
//Do something
B b = new B();
classBRedisTemplate.opsForValue().set("keyB", b);
}
}