redistemplate实现事务问题

https://www.cnblogs.com/zxf330301/p/6889202.html

 

  1. SessionCallback   sessionCallback=new SessionCallback(){  
  2.   @Override  
  3.    public Object execute(RedisOperations operations) throws DataAccessException{  
  4. operations.multi();  
  5. operations.delete("test");  
  6. operations.opsForValue.set("test","2");  
  7. Object val=operations.exec();  
  8. return val;  
  9. }  
  10. }  
  11. StringRedisTemplate.execute(sessionCallback); 
  12. 你可能感兴趣的:(maven的那些坑)