Package org.apache.cayenne.cache
Class NestedQueryCache
java.lang.Object
org.apache.cayenne.cache.NestedQueryCache
- All Implemented Interfaces:
- QueryCache
public class NestedQueryCache extends Object implements QueryCache
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.- Since:
- 3.0
- 
Field SummaryFields Modifier and Type Field Description protected QueryCachedelegateprotected Stringnamespace
- 
Constructor SummaryConstructors Constructor Description NestedQueryCache(QueryCache delegate)
- 
Method SummaryModifier and Type Method Description voidclear()Deprecated.since 4.0Listget(QueryMetadata metadata)Returns a cached query result for the given QueryMetadata or null if the result is not cached or is expired.Listget(QueryMetadata metadata, QueryCacheEntryFactory factory)Returns a cached query result for the given QueryMetadata.QueryCachegetDelegate()Returns the actual implementation of the query cache that is wrapped by this NestedQueryCache.voidput(QueryMetadata metadata, List results)voidremove(String key)Removes an entry for key in the current namespace.voidremoveGroup(String groupKey)Invalidates a shared cache group.voidremoveGroup(String groupKey, Class<?> keyType, Class<?> valueType)Removes a group of entries identified by group key.
- 
Field Details- 
delegate
- 
namespace
 
- 
- 
Constructor Details- 
NestedQueryCache
 
- 
- 
Method Details- 
getDelegateReturns the actual implementation of the query cache that is wrapped by this NestedQueryCache.
- 
clearDeprecated.since 4.0Clears the underlying shared cache.- Specified by:
- clearin interface- QueryCache
- See Also:
- QueryCache.clear()
 
- 
getDescription copied from interface:QueryCacheReturns a cached query result for the given QueryMetadata. If the result is not cached or is expired, cache will use provided factory to rebuild the value and store it in the cache. A corollary is that this method never returns null.Compared to 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.- Specified by:
- getin interface- QueryCache
 
- 
getDescription copied from interface:QueryCacheReturns a cached query result for the given QueryMetadata or null if the result is not cached or is expired.- Specified by:
- getin interface- QueryCache
 
- 
put- Specified by:
- putin interface- QueryCache
 
- 
removeRemoves an entry for key in the current namespace.- Specified by:
- removein interface- QueryCache
 
- 
removeGroupInvalidates a shared cache group.- Specified by:
- removeGroupin interface- QueryCache
 
- 
removeGroupDescription copied from interface:QueryCacheRemoves a group of entries identified by group key. Can be used if cache provider supports strictly typed caches.- Specified by:
- removeGroupin interface- QueryCache
- See Also:
- QueryCache.removeGroup(String)
 
 
-