public class MorphiumCacheImpl extends Object implements MorphiumCache
| Constructor and Description |
|---|
MorphiumCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCacheListener(CacheListener cl) |
<T> void |
addToCache(String k,
Class<? extends T> type,
List<T> ret)
adds some list of objects to the cache manually...
|
void |
clearCachefor(Class<?> cls) |
void |
clearCacheIfNecessary(Class cls) |
Map<Class<?>,Map<String,CacheEntry>> |
getCache() |
Set<Class<?>> |
getCachedTypes() |
String |
getCacheKey(Class type,
Map<String,Object> qo,
Map<String,Integer> sort,
Map<String,Object> projection,
String collection,
int skip,
int limit) |
String |
getCacheKey(Query q)
create unique cache key for queries, also honoring skip & limit and sorting
|
javax.cache.CacheManager |
getCacheManager() |
<T> List<T> |
getFromCache(Class<? extends T> type,
String k)
return object by from cache.
|
<T> T |
getFromIDCache(Class<? extends T> type,
Object id) |
Map<String,Integer> |
getSizes() |
boolean |
isCached(Class<?> type,
String k) |
boolean |
isListenerRegistered(CacheListener cl) |
void |
removeCacheListener(CacheListener cl) |
void |
removeEntryFromCache(Class cls,
Object id) |
void |
removeEntryFromIdCache(Class cls,
Object id) |
void |
resetCache() |
void |
setAnnotationAndReflectionHelper(AnnotationAndReflectionHelper hlp) |
void |
setCache(Map<Class<?>,Map<String,CacheEntry>> cache) |
void |
setCacheManager(javax.cache.CacheManager cacheManager) |
void |
setDefaultCacheTime(Class type)
reset cache time settings to default, if settings were cahnged using setValidCacheTime
|
void |
setGlobalCacheTimeout(int tm) |
void |
setHouskeepingIntervalPause(int p) |
void |
setValidCacheTime(Class type,
int time)
override the settings given in @Cache annotation with this value
this is useful to change cache behaviour during runtime
|
public void setGlobalCacheTimeout(int tm)
setGlobalCacheTimeout in interface MorphiumCachepublic void setHouskeepingIntervalPause(int p)
setHouskeepingIntervalPause in interface MorphiumCachepublic void setAnnotationAndReflectionHelper(AnnotationAndReflectionHelper hlp)
setAnnotationAndReflectionHelper in interface MorphiumCachepublic void addCacheListener(CacheListener cl)
addCacheListener in interface MorphiumCachepublic boolean isListenerRegistered(CacheListener cl)
isListenerRegistered in interface MorphiumCachepublic void removeCacheListener(CacheListener cl)
removeCacheListener in interface MorphiumCachepublic <T> void addToCache(String k, Class<? extends T> type, List<T> ret)
addToCache in interface MorphiumCacheT - - Type of recordk - - Key, usually the mongodb query string - should be created by createCacheKeytype - - class typeret - - list of resultspublic void clearCacheIfNecessary(Class cls)
clearCacheIfNecessary in interface MorphiumCachepublic boolean isCached(Class<?> type, String k)
isCached in interface MorphiumCachepublic <T> List<T> getFromCache(Class<? extends T> type, String k)
getFromCache in interface MorphiumCacheT - - type paramtype - - typek - - cache keypublic Map<Class<?>,Map<String,CacheEntry>> getCache()
public void setCache(Map<Class<?>,Map<String,CacheEntry>> cache)
public <T> T getFromIDCache(Class<? extends T> type, Object id)
getFromIDCache in interface MorphiumCachepublic void setValidCacheTime(Class type, int time)
MorphiumCachesetValidCacheTime in interface MorphiumCachepublic void setDefaultCacheTime(Class type)
MorphiumCachesetDefaultCacheTime in interface MorphiumCachepublic String getCacheKey(Class type, Map<String,Object> qo, Map<String,Integer> sort, Map<String,Object> projection, String collection, int skip, int limit)
getCacheKey in interface MorphiumCachepublic String getCacheKey(Query q)
getCacheKey in interface MorphiumCacheq - the querypublic void clearCachefor(Class<?> cls)
clearCachefor in interface MorphiumCachepublic Set<Class<?>> getCachedTypes()
getCachedTypes in interface MorphiumCachepublic void resetCache()
resetCache in interface MorphiumCachepublic void removeEntryFromIdCache(Class cls, Object id)
removeEntryFromIdCache in interface MorphiumCachepublic void removeEntryFromCache(Class cls, Object id)
removeEntryFromCache in interface MorphiumCachepublic Map<String,Integer> getSizes()
getSizes in interface MorphiumCachepublic void setCacheManager(javax.cache.CacheManager cacheManager)
setCacheManager in interface MorphiumCachepublic javax.cache.CacheManager getCacheManager()
getCacheManager in interface MorphiumCacheCopyright © 2019. All rights reserved.