Package com.usatiuk.objects.stores
Class CachingObjectPersistentStore
java.lang.Object
com.usatiuk.objects.stores.CachingObjectPersistentStore
CachingObjectPersistentStore is a caching layer for the SerializingObjectPersistentStore
It stores the already deserialized objects in memory.
Not (yet) thread safe for writes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
commitTx
(TxManifestObj<? extends JDataVersionedWrapper> objs, long txId) Commit the transaction to the underlying store and update the cache.Get a snapshot of underlying store and the cache.
-
Constructor Details
-
CachingObjectPersistentStore
public CachingObjectPersistentStore(int sizeLimit)
-
-
Method Details
-
commitTx
Commit the transaction to the underlying store and update the cache. Once this function returns, the transaction is committed and the cache is updated.- Parameters:
objs
- the transaction manifest objecttxId
- the transaction ID
-
getSnapshot
Get a snapshot of underlying store and the cache. Objects are read from the cache if possible, if not, they are read from the underlying store, then possibly lazily cached when their data is accessed.- Returns:
- a snapshot of the cached store
-