public class MapQueryCache extends Object implements QueryCache, Serializable
QueryCache interface that stores data in a
non-expiring LRUMap.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CACHE_SIZE |
protected Map<String,org.apache.cayenne.cache.MapQueryCache.CacheEntry> |
map |
| Constructor and Description |
|---|
MapQueryCache() |
MapQueryCache(int maxSize) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final int DEFAULT_CACHE_SIZE
public MapQueryCache()
public MapQueryCache(int maxSize)
public List get(QueryMetadata metadata)
QueryCacheget in interface QueryCachepublic 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 QueryCachepublic void put(QueryMetadata metadata, List results)
put in interface QueryCachepublic void remove(String key)
QueryCacheremove in interface QueryCachepublic void removeGroup(String groupKey)
QueryCacheremoveGroup in interface QueryCachepublic void clear()
QueryCacheclear in interface QueryCachepublic int size()
QueryCachesize in interface QueryCacheCopyright © 2001–2018 Apache Cayenne. All rights reserved.