Transactions 1 require 'pstore' 2 3 p = PStore.new('foo.db') 4 p.transaction do 5 p['foo'] = 42 6 p['bar'] = foo() 7 end Transactions allow your code to do work in memory then commit only when the work is done. Whenever possible, write methods that only modify state when all other work is done.