3 ms·
Yes, these approaches provide proper transactions, but the approach is much simpler than you imagine. Imagine you have a graph of objects in RAM. Say, a Set of
by wpietri 15y ago
Yes, these approaches provide proper transactions, but the approach is much simpler than you imagine.
Imagine you have a graph of objects in RAM. Say, a Set of Counters. Imagine you want to change the graph by incrementing a counter. To do this create an object, the UpdateCounterCommand, with one method: execute. You hand the command to the system, and it puts it in a queue. When it gets to the top, it serializes the command to disk and then executes it. Exactly one write command runs at a time.
For a real-world example, check out Prevayler. It provides all the ACID guarantees that a database does, but in a very small amount of code.