Class PdoCacheFileStore<T extends PersistentDomainObject<T>>

java.lang.Object
org.tentackle.pdo.PdoCacheFileStore<T>
Type Parameters:
T - the PDO type
All Implemented Interfaces:
Serializable

public class PdoCacheFileStore<T extends PersistentDomainObject<T>> extends Object implements Serializable
A file-based backup store for PdoCache.
Serializes the cache to the filesystem to improve client startup times, especially for preloading caches.
Makes only sense for remote client applications.
Author:
harald
See Also:
  • Constructor Details

    • PdoCacheFileStore

      public PdoCacheFileStore(PdoCache<T> cache)
      Creates a file store for a cache.
      Parameters:
      cache - the cache
  • Method Details

    • writeToFile

      public boolean writeToFile()
      Writes the cache to persistent storage.
      Throws PdoRuntimeException if writing failed.
      Returns:
      true if cache has been persisted, false if cache isn't persistable (application is not a client)
    • readFromFile

      public boolean readFromFile(Session session)
      Loads a cache from persistent storage.
      Throws PdoRuntimeException if reading failed.
      Parameters:
      session - the session
      Returns:
      true if loaded from persistent storage or data was missing, false if cache isn't persistable (application is not a client)