Transactions in STM
You’ve undoubtedly used transactions in databases and are familiar with their Atomicity, Consistency, Isolation, and Durability (ACID) properties. Clojure’s STM provides the first three of these properties, but it doesn’t provide durability, because the data is entirely in memory and not in a database or file system.
Atomicity: STM transactions are atomic. Either all the changes we make in a transaction are visible outside the transaction or none of them are visible. All changes to refs in a transaction are kept or none at all.
Consistency: Either the transactions entirely run to completion and we see its net change or they fail, leaving things unaffected. From the outside of these transactions, we see one change consistently ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access