Interface PdoCacheFactory
- 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 readOnly) Creates a PDO-cache.
The cache is created with the default strategyPdoCacheStrategy.PRELOAD.<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 all registered caches.<T extends PersistentDomainObject<T>>
PdoCache<T> Checks whether a PDO-class provides a cache.static PdoCacheFactoryThe singleton.voidRemoves all objects in ALL caches that refer to a given session.
Useful after having closed a session in a TRIP-Server, for example.
-
Method Details
-
getInstance
-
createCache
Creates a PDO-cache.
The cache is created with the default strategyPdoCacheStrategy.PRELOAD.- Type Parameters:
T- the PDO type- Parameters:
clazz- is the PDO-class managed by the cachereadOnly- true if the cache is readonly- Returns:
- the cache
- Throws:
PersistenceException- if a cache is already registered for the class (PDO-caches are singletons per PDO-type)
-
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 a TRIP-Server, for example.- Parameters:
session- the session (probably closed)
-
getAllCaches
Collection<PdoCache<? extends PersistentDomainObject<?>>> getAllCaches()Gets all registered caches.- Returns:
- a snapshot of 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
-