|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.cache.NestedQueryCache
public class NestedQueryCache
A QueryCache
wrapper that introduces a key namespace on top of a delegate
shared cache. This way multiple cache users can share the same underlying cache without
a possibility of key conflicts, yet refresh the cache groups in a coordinated fashion.
Field Summary | |
---|---|
protected QueryCache |
delegate
|
protected String |
namespace
|
Constructor Summary | |
---|---|
NestedQueryCache(QueryCache delegate)
|
Method Summary | |
---|---|
void |
clear()
Clears the underlying shared cache. |
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 cached query result for the given QueryMetadata. |
QueryCache |
getDelegate()
Returns the actual implementation of the query cache that is wrapped by this NestedQueryCache. |
void |
put(QueryMetadata metadata,
List results)
|
void |
remove(String key)
Removes an entry for key in the current namespace. |
void |
removeGroup(String groupKey)
Invalidates a shared cache group. |
int |
size()
Returns a shared cache size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected QueryCache delegate
protected String namespace
Constructor Detail |
---|
public NestedQueryCache(QueryCache delegate)
Method Detail |
---|
public QueryCache getDelegate()
public void clear()
clear
in interface QueryCache
public List get(QueryMetadata metadata, QueryCacheEntryFactory factory)
QueryCache
QueryCache.get(QueryMetadata)
, this method allows the cache to do
appropriate synchronization when refreshing the entry, preventing multiple threads
from running the same query when a missing entry is requested by multiple threads
simultaneously.
get
in interface QueryCache
public List get(QueryMetadata metadata)
QueryCache
get
in interface QueryCache
public void put(QueryMetadata metadata, List results)
put
in interface QueryCache
public void remove(String key)
remove
in interface QueryCache
public void removeGroup(String groupKey)
removeGroup
in interface QueryCache
public int size()
size
in interface QueryCache
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |