- All Known Implementing Classes:
DefaultPdoCacheFactory
public interface PdoCacheFactory
Factory for PDO-Caches.
The factory keeps a list of all created caches.
The factory keeps a list of all created caches.
- Author:
- harald
-
Method Summary
Modifier and TypeMethodDescription<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.<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.Collection
<PdoCache<? extends PersistentDomainObject<?>>> Gets a list of all registered caches.<T extends PersistentDomainObject<T>>
PdoCache<T> Checks whether a PDO-class provides a cache.static PdoCacheFactory
The singleton.void
Removes all objects in ALL caches that refer to a given session.
Useful after having closed a session in an RMI-Server, for example.
-
Method Details
-
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 cachepreload
- is true if preload all objects in domain context of cachereadOnly
- true if cache is readonlycheckSecurity
- 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 typeC
- the key type- Parameters:
name
- the index nameselectFunction
- the function to select a PDO by keyextractFunction
- the function to extract the key from a PDO- Returns:
- the index
-
removeObjectsForSessionInAllCaches
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
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
-