Package de.caluga.morphium.cache
Class MorphiumCacheJCacheImpl
- java.lang.Object
-
- de.caluga.morphium.cache.MorphiumCacheJCacheImpl
-
- All Implemented Interfaces:
MorphiumCache,EventListener,javax.cache.event.CacheEntryCreatedListener<Object,CacheEntry>,javax.cache.event.CacheEntryExpiredListener<Object,CacheEntry>,javax.cache.event.CacheEntryListener<Object,CacheEntry>,javax.cache.event.CacheEntryRemovedListener<Object,CacheEntry>,javax.cache.event.CacheEntryUpdatedListener<Object,CacheEntry>
public class MorphiumCacheJCacheImpl extends Object implements MorphiumCache, javax.cache.event.CacheEntryExpiredListener<Object,CacheEntry>, javax.cache.event.CacheEntryCreatedListener<Object,CacheEntry>, javax.cache.event.CacheEntryRemovedListener<Object,CacheEntry>, javax.cache.event.CacheEntryUpdatedListener<Object,CacheEntry>
User: Stephan Bösebeck Date: 18.05.18 Time: 14:52TODO: Add documentation here
-
-
Field Summary
Fields Modifier and Type Field Description static StringID_CACHE_NAMEstatic StringRESULT_CACHE_NAME
-
Constructor Summary
Constructors Constructor Description MorphiumCacheJCacheImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCacheListener(CacheListener cl)<T> voidaddToCache(String k, Class<? extends T> type, List<T> ret)voidclearCachefor(Class<?> cls)voidclearCacheIfNecessary(Class cls)voidclose()Set<Class<?>>getCachedTypes()StringgetCacheKey(Query q)StringgetCacheKey(Class type, Map<String,Object> qo, Map<String,Integer> sort, Map<String,Object> projection, String collection, int skip, int limit)javax.cache.CacheManagergetCacheManager()<T> List<T>getFromCache(Class<? extends T> type, String k)<T> TgetFromIDCache(Class<? extends T> type, Object id)Map<String,Integer>getSizes()booleanisCached(Class<?> type, String k)booleanisListenerRegistered(CacheListener cl)voidonCreated(Iterable iterable)voidonExpired(Iterable iterable)voidonRemoved(Iterable iterable)voidonUpdated(Iterable iterable)voidremoveCacheListener(CacheListener cl)voidremoveEntryFromCache(Class cls, Object id)voidremoveEntryFromIdCache(Class cls, Object id)voidresetCache()voidsetAnnotationAndReflectionHelper(AnnotationAndReflectionHelper hlp)voidsetCacheManager(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
-
-
-
Field Detail
-
RESULT_CACHE_NAME
public static final String RESULT_CACHE_NAME
- See Also:
- Constant Field Values
-
ID_CACHE_NAME
public static final String ID_CACHE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setCacheManager
public void setCacheManager(javax.cache.CacheManager cacheManager)
- Specified by:
setCacheManagerin interfaceMorphiumCache
-
getCacheManager
public javax.cache.CacheManager getCacheManager()
- Specified by:
getCacheManagerin interfaceMorphiumCache
-
addToCache
public <T> void addToCache(String k, Class<? extends T> type, List<T> ret)
- Specified by:
addToCachein interfaceMorphiumCache
-
getSizes
public Map<String,Integer> getSizes()
- Specified by:
getSizesin 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
-
getFromCache
public <T> List<T> getFromCache(Class<? extends T> type, String k)
- Specified by:
getFromCachein interfaceMorphiumCache
-
getCachedTypes
public Set<Class<?>> getCachedTypes()
- Specified by:
getCachedTypesin interfaceMorphiumCache
-
clearCachefor
public void clearCachefor(Class<?> cls)
- Specified by:
clearCacheforin interfaceMorphiumCache
-
resetCache
public void resetCache()
- Specified by:
resetCachein interfaceMorphiumCache
-
close
public void close()
- Specified by:
closein interfaceMorphiumCache
-
removeEntryFromIdCache
public void removeEntryFromIdCache(Class cls, Object id)
- Specified by:
removeEntryFromIdCachein interfaceMorphiumCache
-
removeEntryFromCache
public void removeEntryFromCache(Class cls, Object id)
- Specified by:
removeEntryFromCachein interfaceMorphiumCache
-
getFromIDCache
public <T> T getFromIDCache(Class<? extends T> type, Object id)
- Specified by:
getFromIDCachein interfaceMorphiumCache
-
getCacheKey
public String getCacheKey(Query q)
- Specified by:
getCacheKeyin interfaceMorphiumCache
-
isCached
public boolean isCached(Class<?> type, String k)
- Specified by:
isCachedin interfaceMorphiumCache
-
clearCacheIfNecessary
public void clearCacheIfNecessary(Class cls)
- Specified by:
clearCacheIfNecessaryin interfaceMorphiumCache
-
addCacheListener
public void addCacheListener(CacheListener cl)
- Specified by:
addCacheListenerin interfaceMorphiumCache
-
removeCacheListener
public void removeCacheListener(CacheListener cl)
- Specified by:
removeCacheListenerin interfaceMorphiumCache
-
isListenerRegistered
public boolean isListenerRegistered(CacheListener cl)
- Specified by:
isListenerRegisteredin interfaceMorphiumCache
-
setGlobalCacheTimeout
public void setGlobalCacheTimeout(int tm)
- Specified by:
setGlobalCacheTimeoutin interfaceMorphiumCache
-
setAnnotationAndReflectionHelper
public void setAnnotationAndReflectionHelper(AnnotationAndReflectionHelper hlp)
- Specified by:
setAnnotationAndReflectionHelperin interfaceMorphiumCache
-
setHouskeepingIntervalPause
public void setHouskeepingIntervalPause(int p)
- Specified by:
setHouskeepingIntervalPausein interfaceMorphiumCache
-
setValidCacheTime
public void setValidCacheTime(Class type, int time)
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
public void setDefaultCacheTime(Class type)
Description copied from interface:MorphiumCachereset cache time settings to default, if settings were cahnged using setValidCacheTime- Specified by:
setDefaultCacheTimein interfaceMorphiumCache
-
onCreated
public void onCreated(Iterable iterable) throws javax.cache.event.CacheEntryListenerException
- Specified by:
onCreatedin interfacejavax.cache.event.CacheEntryCreatedListener<Object,CacheEntry>- Throws:
javax.cache.event.CacheEntryListenerException
-
onExpired
public void onExpired(Iterable iterable) throws javax.cache.event.CacheEntryListenerException
- Specified by:
onExpiredin interfacejavax.cache.event.CacheEntryExpiredListener<Object,CacheEntry>- Throws:
javax.cache.event.CacheEntryListenerException
-
onRemoved
public void onRemoved(Iterable iterable) throws javax.cache.event.CacheEntryListenerException
- Specified by:
onRemovedin interfacejavax.cache.event.CacheEntryRemovedListener<Object,CacheEntry>- Throws:
javax.cache.event.CacheEntryListenerException
-
onUpdated
public void onUpdated(Iterable iterable) throws javax.cache.event.CacheEntryListenerException
- Specified by:
onUpdatedin interfacejavax.cache.event.CacheEntryUpdatedListener<Object,CacheEntry>- Throws:
javax.cache.event.CacheEntryListenerException
-
-