Interface PdoCacheFactory

All Known Implementing Classes:
DefaultPdoCacheFactory

public interface PdoCacheFactory
Factory for PDO-Caches.
The factory keeps a list of all created caches.
Author:
harald
  • Method Details

    • getInstance

      static PdoCacheFactory getInstance()
      The singleton.
      Returns:
      the singleton
    • createCache

      <T extends PersistentDomainObject<T>> PdoCache<T> createCache(Class<T> clazz, boolean preload, boolean readOnly, boolean checkSecurity)
      Creates a PDO-cache.
      Multiple calls on this method return the same object reference, since PDO-caches are singletons per PDO-type.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - is the PDO-class managed by the cache
      preload - is true if preload all objects in domain context of cache
      readOnly - true if cache is readonly
      checkSecurity - true if read permission is checked
      Returns:
      the cache
    • createCacheIndex

      <T extends PersistentDomainObject<T>, C extends Comparable<? super C>> PdoCacheIndex<T,C> createCacheIndex(String name, BiFunction<DomainContext,C,T> selectFunction, Function<T,C> extractFunction)
      Creates an index for a PDO-cache.
      Type Parameters:
      T - the PDO type
      C - the key type
      Parameters:
      name - the index name
      selectFunction - the function to select a PDO by key
      extractFunction - the function to extract the key from a PDO
      Returns:
      the index
    • removeObjectsForSessionInAllCaches

      void removeObjectsForSessionInAllCaches(Session session)
      Removes all objects in ALL caches that refer to a given session.
      Useful after having closed a session in an RMI-Server, for example.
      Parameters:
      session - the session (probably closed)
    • getAllCaches

      Collection<PdoCache<? extends PersistentDomainObject<?>>> getAllCaches()
      Gets a list of all registered caches.
      Returns:
      all registered caches
    • getCache

      <T extends PersistentDomainObject<T>> PdoCache<T> getCache(Class<T> clazz)
      Checks whether a PDO-class provides a cache.
      Type Parameters:
      T - the PDO class type
      Parameters:
      clazz - the class
      Returns:
      the cache, null if none