案列

  1. 127.0.0.1:6379> SET msg hello
  2. OK
  3. 127.0.0.1:6379> MULTI
  4. OK
  5. 127.0.0.1:6379> SADD fruit apple bannana
  6. QUEUED
  7. 127.0.0.1:6379> RPUSH msg "good bye" "bye bye"
  8. QUEUED
  9. 127.0.0.1:6379> SADD alphabet a b c d
  10. QUEUED
  11. 127.0.0.1:6379> EXEC
  12. 1) (integer) 2
  13. 2) (error) WRONGTYPE Operation against a key holding the wrong kind of value
  14. 3) (integer) 4
  15. 127.0.0.1:6379> SMEMBERS fruit # 即使事务队列中命令出错,整个事务也会继续执行且结果保留
  16. 1) "bannana"
  17. 2) "apple"