-
Notifications
You must be signed in to change notification settings - Fork 12
Advanced Concepts
To reduce the memory footprint of POJO-MVCC we support cache eviction strategies. The cache eviction works per revision, and can remove revisions that are no longer required.
A CacheExpiry consists of two elements, the CacheExpiryPolicy which determines if a revision should be expired, and an optional CacheExpirationHandler which can be specified to provide any required processing of evicted revisions.
A code.google.pojomvcc.CacheExpiryPolicy object defines when revisions should be evicted from the RootObjectCache. The default setting is to NOT_USED which will automatically purge any revisions from the cache that are no longer referenced by open RevisionObjectCahces.
Other CacheExpiryPolicys included in POJO-MVCC include:
NOT_USED - remove any revisions the moment there is no RevisionObjectCaches referring to a revision. NEVER - never remove a revision from the cache. TIME - remove any revisions that have not been updated in the past (X) seconds.
You can implement your own CacheExpiryPolicy by simply extending the abstract CacheExpiryPolicy and implementing the required methods.
Along with a code.google.pojomvcc.CacheExpiryPolicy an optional CacheExpirationHandler may be provided which will be notified when the cache is about to evict a revision.
It is possible to move the revision to storage on disk or some other persistence if so desired.
The default setting is NO_OP which does nothing when a revision is expired from the cache