Package de.caluga.morphium.cache
Class MorphiumCacheImpl
java.lang.Object
de.caluga.morphium.cache.MorphiumCacheImpl
- All Implemented Interfaces:
MorphiumCache
User: Stephan Bösebeck
Date: 07.03.13
Time: 10:56
The Cache implementation for morphium.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid<T> voidaddToCache(String k, Class<? extends T> type, List<T> ret) adds some list of objects to the cache manually...voidclearCachefor(Class<?> cls) voidvoidclose()Map<Class<?>,Map<String, CacheEntry>> getCache()getCacheKey(Query q) create unique cache key for queries, also honoring skip invalid input: '&' limit and sortinggetCacheKey(Class type, Map<String, Object> qo, Map<String, Integer> sort, Map<String, Object> projection, String collection, int skip, int limit) javax.cache.CacheManager<T> List<T>getFromCache(Class<? extends T> type, String k) return object by from cache.<T> TgetFromIDCache(Class<? extends T> type, Object id) getSizes()booleanbooleanvoidvoidremoveEntryFromCache(Class cls, Object id) voidremoveEntryFromIdCache(Class cls, Object id) voidvoidvoidvoidsetCacheManager(javax.cache.CacheManager cacheManager) voidsetDefaultCacheTime(Class type) reset cache time settings to default, if settings were cahnged using setValidCacheTimevoidsetGlobalCacheTimeout(int tm) voidsetHouskeepingIntervalPause(int p) voidsetValidCacheTime(Class type, int time) override the settings given in @Cache annotation with this value this is useful to change cache behaviour during runtime
-
Constructor Details
-
MorphiumCacheImpl
public MorphiumCacheImpl()
-
-
Method Details
-
setGlobalCacheTimeout
public void setGlobalCacheTimeout(int tm) - Specified by:
setGlobalCacheTimeoutin interfaceMorphiumCache
-
setHouskeepingIntervalPause
public void setHouskeepingIntervalPause(int p) - Specified by:
setHouskeepingIntervalPausein interfaceMorphiumCache
-
setAnnotationAndReflectionHelper
- Specified by:
setAnnotationAndReflectionHelperin interfaceMorphiumCache
-
addCacheListener
- Specified by:
addCacheListenerin interfaceMorphiumCache
-
isListenerRegistered
- Specified by:
isListenerRegisteredin interfaceMorphiumCache
-
removeCacheListener
- Specified by:
removeCacheListenerin interfaceMorphiumCache
-
addToCache
adds some list of objects to the cache manually... is being used internally, and should be used with care- Specified by:
addToCachein interfaceMorphiumCache- Type Parameters:
T- - Type of record- Parameters:
k- - Key, usually the mongodb query string - should be created by createCacheKeytype- - class typeret- - list of results
-
clearCacheIfNecessary
- Specified by:
clearCacheIfNecessaryin interfaceMorphiumCache
-
isCached
- Specified by:
isCachedin interfaceMorphiumCache
-
getFromCache
return object by from cache. Cache key usually is the string-representation of the search query.toQueryObject()- Specified by:
getFromCachein interfaceMorphiumCache- Type Parameters:
T- - type param- Parameters:
type- - typek- - cache key- Returns:
- resulting list
-
getCache
-
setCache
-
getFromIDCache
- Specified by:
getFromIDCachein interfaceMorphiumCache
-
setValidCacheTime
Description copied from interface:MorphiumCacheoverride the settings given in @Cache annotation with this value this is useful to change cache behaviour during runtime- Specified by:
setValidCacheTimein interfaceMorphiumCache
-
setDefaultCacheTime
Description copied from interface:MorphiumCachereset cache time settings to default, if settings were cahnged using setValidCacheTime- Specified by:
setDefaultCacheTimein interfaceMorphiumCache
-
getCacheKey
public String getCacheKey(Class type, Map<String, Object> qo, Map<String, Integer> sort, Map<String, Object> projection, String collection, int skip, int limit) - Specified by:
getCacheKeyin interfaceMorphiumCache
-
getCacheKey
create unique cache key for queries, also honoring skip invalid input: '&' limit and sorting- Specified by:
getCacheKeyin interfaceMorphiumCache- Parameters:
q- the query- Returns:
- the resulting cache key
-
clearCachefor
- Specified by:
clearCacheforin interfaceMorphiumCache
-
getCachedTypes
- Specified by:
getCachedTypesin interfaceMorphiumCache
-
resetCache
public void resetCache()- Specified by:
resetCachein interfaceMorphiumCache
-
close
public void close()- Specified by:
closein interfaceMorphiumCache
-
removeEntryFromIdCache
- Specified by:
removeEntryFromIdCachein interfaceMorphiumCache
-
removeEntryFromCache
- Specified by:
removeEntryFromCachein interfaceMorphiumCache
-
getSizes
- Specified by:
getSizesin interfaceMorphiumCache
-
setCacheManager
public void setCacheManager(javax.cache.CacheManager cacheManager) - Specified by:
setCacheManagerin interfaceMorphiumCache
-
getCacheManager
public javax.cache.CacheManager getCacheManager()- Specified by:
getCacheManagerin interfaceMorphiumCache
-