Skip to content

Commit

Permalink
Merge pull request #61 from vekat/patch-1
Browse files Browse the repository at this point in the history
Update Mache's example on README.md
  • Loading branch information
KrisSiegel authored Nov 26, 2016
2 parents e64b9e2 + e6feb9e commit 243c27b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ mache.set("mykey", {
test: "anothertest"
});

mache.get("mykey"); // returns { test: "anothertest" }

mache.revert("mykey");

mache.get("mykey"); // returns { test: "mykey" }
mache.get("mykey"); // returns { test: "mytest" }
```

Mache transactions work similar to SQL transactions; when you want to start simply call ```.begin()``` on your mache instance, then get and set whatever you want. Once you're finished either call ```.rollback()``` to end the transaction and eliminate all changes done during that time or ```.commit()``` to commit all of the changes made. You can even create a mache instance with some configuration options to change the level of revisions to store outside of transactions along with emitting all changes through messages so as data changes your components can react to said changes.
Expand Down

0 comments on commit 243c27b

Please sign in to comment.