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) |
Hashtable<Class<?>,Hashtable<String,CacheElement>> |
cloneCache() |
Hashtable<Class<?>,Hashtable<Object,Object>> |
cloneIdCache() |
String |
getCacheKey(com.mongodb.DBObject qo,
Map<String,Integer> sort,
String collection,
int skip,
int limit) |
String |
getCacheKey(Query q)
create unique cache key for queries, also honoring skip & limit and sorting
|
<T> List<T> |
getFromCache(Class<? extends T> type,
String k)
return object by from cache.
|
<T> T |
getFromIDCache(Class<? extends T> type,
Object id) |
boolean |
isCached(Class<?> type,
String k) |
void |
removeCacheListener(CacheListener cl) |
void |
removeEntryFromCache(Class cls,
Object id) |
void |
resetCache() |
void |
setCache(Hashtable<Class<?>,Hashtable<String,CacheElement>> cache) |
void |
setIdCache(Hashtable<Class<?>,Hashtable<Object,Object>> c) |
public void addCacheListener(CacheListener cl)
addCacheListener 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 Hashtable<Class<?>,Hashtable<String,CacheElement>> cloneCache()
cloneCache in interface MorphiumCachepublic Hashtable<Class<?>,Hashtable<Object,Object>> cloneIdCache()
cloneIdCache in interface MorphiumCachepublic <T> T getFromIDCache(Class<? extends T> type, Object id)
getFromIDCache in interface MorphiumCachepublic String getCacheKey(com.mongodb.DBObject qo, Map<String,Integer> sort, 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 void resetCache()
resetCache in interface MorphiumCachepublic void setCache(Hashtable<Class<?>,Hashtable<String,CacheElement>> cache)
setCache in interface MorphiumCachepublic void removeEntryFromCache(Class cls, Object id)
removeEntryFromCache in interface MorphiumCachepublic void setIdCache(Hashtable<Class<?>,Hashtable<Object,Object>> c)
setIdCache in interface MorphiumCacheCopyright © 2014. All Rights Reserved.