Class CachingObjectPersistentStore

java.lang.Object
com.usatiuk.objects.stores.CachingObjectPersistentStore

@ApplicationScoped public class CachingObjectPersistentStore extends Object
CachingObjectPersistentStore is a caching layer for the SerializingObjectPersistentStore It stores the already deserialized objects in memory. Not (yet) thread safe for writes.
  • Constructor Details

    • CachingObjectPersistentStore

      public CachingObjectPersistentStore(int sizeLimit)
  • Method Details

    • commitTx

      public void commitTx(TxManifestObj<? extends JDataVersionedWrapper> objs, long txId)
      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 object
      txId - the transaction ID
    • getSnapshot

      public Snapshot<JObjectKey,JDataVersionedWrapper> 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