Interface QueryResultsCache
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractMapQueryResultsCache,AbstractQueryResultsCache,JavaxCacheQueryResultCache,SoftQueryResultsCache,StrongQueryResultsCache,WeakQueryResultsCache
public interface QueryResultsCache extends Serializable
Cache for query results.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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.default booleanisEmpty()Accessor for whether the cache is empty.default voidpin(Query query)Method to pin the specified query in the cache, preventing garbage collection.default voidpin(Query query, Map params)Method to pin the specified query in the cache, preventing garbage collection.List<Object>put(String queryKey, List<Object> results)Method to put an object in the cache.default intsize()Accessor for the total number of results in the query cache.default voidunpin(Query query)Method to unpin the specified query from the cache, allowing garbage collection.default voidunpin(Query query, Map params)Method to unpin the specified query from the cache, allowing garbage collection.
-
-
-
Method Detail
-
close
void close()
Method to close the cache when no longer needed. Provides a hook to release resources etc.
-
evict
void evict(Class candidate)
Method 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
void evict(Query query)
Evict the query from the results cache.- Parameters:
query- The query to evict (evicts all use of this query, with any params)
-
evict
void evict(Query query, Map params)
Evict the query with the specified params from the results cache.- Parameters:
query- The query to evictparams- The parameters
-
evictAll
void evictAll()
Method to clear the cache.
-
pin
default void pin(Query query)
Method to pin the specified query in the cache, preventing garbage collection.- Parameters:
query- The query
-
pin
default void pin(Query query, Map params)
Method to pin the specified query in the cache, preventing garbage collection.- Parameters:
query- The queryparams- Its params
-
unpin
default void unpin(Query query)
Method to unpin the specified query from the cache, allowing garbage collection.- Parameters:
query- The query
-
unpin
default void unpin(Query query, Map params)
Method to unpin the specified query from the cache, allowing garbage collection.- Parameters:
query- The queryparams- Its params
-
isEmpty
default boolean isEmpty()
Accessor for whether the cache is empty.- Returns:
- Whether it is empty.
-
size
default int size()
Accessor for the total number of results in the query cache.- Returns:
- Number of queries
-
get
List<Object> get(String queryKey)
Accessor for the results from the cache.- Parameters:
queryKey- The query key- Returns:
- The cached query result ids
-
put
List<Object> put(String queryKey, List<Object> results)
Method 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)
-
contains
boolean contains(String queryKey)
Accessor for whether the specified query is in the cache- Parameters:
queryKey- The query key- Returns:
- Whether it is in the cache
-
-