Class JavaxCacheQueryResultCache
- java.lang.Object
-
- org.datanucleus.store.query.cache.AbstractQueryResultsCache
-
- org.datanucleus.store.query.cache.JavaxCacheQueryResultCache
-
- All Implemented Interfaces:
Serializable,QueryResultsCache
public class JavaxCacheQueryResultCache extends AbstractQueryResultsCache
Implementation of a query results cache using javax.cache (v0.3+) interface.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.query.cache.AbstractQueryResultsCache
cacheName, clearAtClose, expiryMillis, maxSize, nucleusCtx
-
-
Constructor Summary
Constructors Constructor Description JavaxCacheQueryResultCache(NucleusContext nucleusCtx)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Method to close the cache when no longer needed.booleancontains(String queryKey)Accessor for whether the specified query is in the cachevoidevict(Class candidate)Method to evict all queries that use the provided class as candidate.voidevict(Query query)Evict the query from the results cache.voidevict(Query query, Map params)Evict the query with the specified params from the results cache.voidevictAll()Method to clear the cache.List<Object>get(String queryKey)Accessor for the results from the cache.List<Object>put(String queryKey, List<Object> results)Method to put an object in the cache.
-
-
-
Constructor Detail
-
JavaxCacheQueryResultCache
public JavaxCacheQueryResultCache(NucleusContext nucleusCtx)
Constructor.- Parameters:
nucleusCtx- Context
-
-
Method Detail
-
close
public void close()
Description copied from interface:QueryResultsCacheMethod to close the cache when no longer needed. Provides a hook to release resources etc.
-
contains
public boolean contains(String queryKey)
Description copied from interface:QueryResultsCacheAccessor for whether the specified query is in the cache- Parameters:
queryKey- The query key- Returns:
- Whether it is in the cache
-
evict
public void evict(Class candidate)
Description copied from interface:QueryResultsCacheMethod to evict all queries that use the provided class as candidate. This is usually called when an instance of the candidate has been changed in the datastore.- Parameters:
candidate- The candidate
-
evict
public void evict(Query query)
Description copied from interface:QueryResultsCacheEvict the query from the results cache.- Parameters:
query- The query to evict (evicts all use of this query, with any params)
-
evict
public void evict(Query query, Map params)
Description copied from interface:QueryResultsCacheEvict the query with the specified params from the results cache.- Parameters:
query- The query to evictparams- The parameters
-
evictAll
public void evictAll()
Description copied from interface:QueryResultsCacheMethod to clear the cache.
-
get
public List<Object> get(String queryKey)
Description copied from interface:QueryResultsCacheAccessor for the results from the cache.- Parameters:
queryKey- The query key- Returns:
- The cached query result ids
-
put
public List<Object> put(String queryKey, List<Object> results)
Description copied from interface:QueryResultsCacheMethod to put an object in the cache.- Parameters:
queryKey- The query keyresults- The results for this query- Returns:
- The result ids previously associated with this query (if any)
-
-