|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.cache.MapQueryCache
public class MapQueryCache
A default implementation of the QueryCache
interface that stores data in a
non-expiring LRUMap.
Field Summary | |
---|---|
static int |
DEFAULT_CACHE_SIZE
|
protected Map<String,org.apache.cayenne.cache.MapQueryCache.CacheEntry> |
map
|
Constructor Summary | |
---|---|
MapQueryCache()
|
|
MapQueryCache(int maxSize)
|
Method Summary | |
---|---|
void |
clear()
Clears all cache entries. |
List |
get(QueryMetadata metadata)
Returns a cached query result for the given QueryMetadata or null if the result is not cached or is expired. |
List |
get(QueryMetadata metadata,
QueryCacheEntryFactory factory)
Returns a non-null cached value. |
void |
put(QueryMetadata metadata,
List results)
|
void |
remove(String key)
Removes a single entry from cache. |
void |
removeGroup(String groupKey)
Removes a group of entries identified by group key. |
int |
size()
Returns the number of entries currently in the cache, including expired but not removed entries. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_CACHE_SIZE
protected Map<String,org.apache.cayenne.cache.MapQueryCache.CacheEntry> map
Constructor Detail |
---|
public MapQueryCache()
public MapQueryCache(int maxSize)
Method Detail |
---|
public List get(QueryMetadata metadata)
QueryCache
get
in interface QueryCache
public List get(QueryMetadata metadata, QueryCacheEntryFactory factory)
QueryCacheEntryFactory.createObject()
without blocking the cache. As
a result there is a potential of multiple threads to be updating cache in parallel -
this wouldn't lead to corruption of the cache, but can be suboptimal.
get
in interface QueryCache
public void put(QueryMetadata metadata, List results)
put
in interface QueryCache
public void remove(String key)
QueryCache
remove
in interface QueryCache
public void removeGroup(String groupKey)
QueryCache
removeGroup
in interface QueryCache
public void clear()
QueryCache
clear
in interface QueryCache
public int size()
QueryCache
size
in interface QueryCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |