redistemplate实现事务问题

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

  1. SessionCallback<Object>   sessionCallback=new SessionCallback<Object>(){  
  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); 

猜你喜欢

转载自blog.csdn.net/Sir_He/article/details/83833659