Class CacheManager
java.lang.Object
org.deltava.util.cache.CacheManager
A utility class to handle centralized cache registration and invalidation.
- Since:
- 5.0
- Version:
- 11.5
- Author:
- Luke
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves an existing cache.static Collection
<CacheInfo> getCacheInfo
(boolean getRemoteSize) Returns information about all caches.static <U, T extends CacheableCollection<U>>
Cache<T> getCollection
(Class<U> c, String id) Retrieves an existing Collection cache.Retrieves an existing GeoCache.static <K, V, T extends CacheableMap<K,
V>>
Cache<T> Retrieves an existing Map cache.static void
Initializes the cache Manager.static void
invalidate
(String id) Invalidates a cache.static void
invalidate
(String id, boolean sendEvent) Invalidates a cache.static void
invalidate
(String id, Object key) Invalidates a cache entry.register
(Class<T> c, CacheConfig cfg) Registers a cache.
-
Method Details
-
init
Initializes the cache Manager.- Parameters:
id
- the application ID
-
getCacheInfo
Returns information about all caches.- Parameters:
getRemoteSize
- TRUE to fetch remote cache sizes, otherwise FALSE- Returns:
- a Collection of CacheInfo objects
-
invalidate
-
invalidate
Invalidates a cache.- Parameters:
id
- the cache IDsendEvent
- sends a system Event to other webapps if TRUE and remote
-
invalidate
-
register
Registers a cache.- Parameters:
c
- the cache content classcfg
- the CacheConfig bean- Returns:
- a Cache
-
get
-
getGeo
-
getCollection
Retrieves an existing Collection cache. This will return aNullCache
if the cache ID has not been registered.- Parameters:
c
- the cache Collection content classid
- the cache ID- Returns:
- a Cache
-
getMap
public static <K, V, T extends CacheableMap<K,V>> Cache<T> getMap(Class<K> k, Class<V> v, String id) Retrieves an existing Map cache. This will return aNullCache
if the cache ID has not been registered.- Parameters:
k
- the cache Map content key classv
- the cache Map content value classid
- the Cache ID- Returns:
- a Cache
-