Interface QueryResultsCache
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractMapQueryResultsCache
,AbstractQueryResultsCache
,JavaxCacheQueryResultCache
,SoftQueryResultsCache
,StrongQueryResultsCache
,WeakQueryResultsCache
Cache for query results.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Method to close the cache when no longer needed.boolean
Accessor for whether the specified query is in the cachevoid
Method to evict all queries that use the provided class as candidate.void
Evict the query from the results cache.void
Evict the query with the specified params from the results cache.void
evictAll()
Method to clear the cache.Accessor for the results from the cache.default boolean
isEmpty()
Accessor for whether the cache is empty.default void
Method to pin the specified query in the cache, preventing garbage collection.default void
Method to pin the specified query in the cache, preventing garbage collection.Method to put an object in the cache.default int
size()
Accessor for the total number of results in the query cache.default void
Method to unpin the specified query from the cache, allowing garbage collection.default void
Method to unpin the specified query from the cache, allowing garbage collection.
-
Method Details
-
close
void close()Method to close the cache when no longer needed. Provides a hook to release resources etc. -
evict
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
Evict the query from the results cache.- Parameters:
query
- The query to evict (evicts all use of this query, with any params)
-
evict
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
Method to pin the specified query in the cache, preventing garbage collection.- Parameters:
query
- The query
-
pin
Method to pin the specified query in the cache, preventing garbage collection.- Parameters:
query
- The queryparams
- Its params
-
unpin
Method to unpin the specified query from the cache, allowing garbage collection.- Parameters:
query
- The query
-
unpin
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
Accessor for the results from the cache.- Parameters:
queryKey
- The query key- Returns:
- The cached query result ids
-
put
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
Accessor for whether the specified query is in the cache- Parameters:
queryKey
- The query key- Returns:
- Whether it is in the cache
-