search

Home  >  Q&A  >  body text

redis是如何做到在不支持原子性的基础上支持一致性的?

最近在学习redis,关于它对事务的支持不是很理解。redis在执行事务中的命令时,出错后不会回滚,但是又看到有人说redis是支持一致性的。我一直以为原子性是一致性的保证之一,如何在不支持原子性的基础上支持一致性的呢?

某草草某草草2775 days ago947

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-25 09:04:20

    Redis cannot guarantee consistency
    Redis transactions do not support rollback, because its function is only for efficient reading of data, not data storage.
    The watch command can add optimistic locking to the specified key. During transaction execution and before exec is submitted, if other sessions change the key, the transaction will fail.

    For details, please refer to: http://m.blog.csdn.net/article/details?i...

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-04-25 09:04:20

    Single process, so it is atomic, but rollback is another concept. .

    reply
    0
  • Cancelreply