-
Notifications
You must be signed in to change notification settings - Fork 12
Getting Started
POJO-MVCC provides a Subversion like cache that can be used with simple Java objects.
- Creating a cache:
` CacheElementFactory factory = new ExampleCacheElementFactory();
RootObjectCache<ExampleKey, ExampleCacheElement> rootCache = new RootObjectCacheImpl<ExampleKey, ExampleCacheElement>(factory); `
-
Checking out from a cache:
RevisionObjectCache<ExampleKey, ExampleCacheElement> revision = rootCache.checkout();
-
Adding / Modifying / Deleting from a cache:
` Example key = new ExampleKey(); revision.addElement(key, new ExampleCacheElement());
revision.get(key).setExample("abcd");
revision.removeElement(key); `
- Checking back in:
rootCache.commit(revision);
- Reverting changes:
revision.revert();
code.google.pojomvcc.CacheElementFactory A CacheElementFactory must be registered with the RootObjectCache and is responsible for cloning and merging elements that are stored in the cache when required by the RootObjectCache.
code.google.pojomvcc.RootObjectCache The RootObjectCache is the base class for POJO-MVCC and is the "root" of the cache graph. A RootObjectCache may not be modified directly, all changes must be made to the RevisionObjectCache that can be obtained by calling checkout().
Once the RevisionObjectCache has been updated (adding, modifying or removing) elements the RootObjectCache is updated using the checkin() method.
code.google.pojomvcc.RevisionObjectCache A RevisionObjectCache represents the RootObjectCache at a specific revision. Modifications may be made to the RevisionObjectCache and later committed to the RootObjectCache.
That's it! Thats all you need to know to use POJO-MVCC
An overview of POJO-MVCC can be found by looking at the Architecture page.
For more advanced features, refer to the AdvancedConcepts page.