Package org.hibernate.cache.spi
Interface QueryResultsCache
-
- All Known Implementing Classes:
QueryResultsCacheImpl
public interface QueryResultsCacheResponsible for managing query result list caching in a specific query cache region. There may be multiple instances ofQueryResultsCache, corresponding to second-level cache regions with distinct policies.A
QueryResultsCachedepends on theTimestampsCacheto track invalidation of the query spaces (tables) which affect the cached queries. A cached query result list is considered stale if any one of the query spaces which affect the query results was invalidated since the result list was read from the database and stored in the query result cache.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclear()Clear all items from this query result cache.default voiddestroy()List<?>get(QueryKey key, String[] spaces, SharedSessionContractImplementor session)Attempt to retrieve a cached query result list for the givenQueryKeyfrom the cache region, and then check if the cached results, if any, are stale.List<?>get(QueryKey key, Set<String> spaces, SharedSessionContractImplementor session)Attempt to retrieve a cached query result list for the givenQueryKeyfrom the cache region, and then check if the cached results, if any, are stale.QueryResultsRegiongetRegion()The underlying cache region being used.booleanput(QueryKey key, List<?> result, SharedSessionContractImplementor session)Store a result list of a query with the givenQueryKeyin the query result cache.
-
-
-
Method Detail
-
getRegion
QueryResultsRegion getRegion()
The underlying cache region being used.
-
put
boolean put(QueryKey key, List<?> result, SharedSessionContractImplementor session) throws HibernateException
Store a result list of a query with the givenQueryKeyin the query result cache.- Parameters:
key- The cache key uniquely identifying the query and its bound parameter argumentsresult- The result list to cachesession- The originating session- Returns:
- Whether the put actually happened.
- Throws:
HibernateException- Indicates a problem delegating to the underlying cache.
-
get
List<?> get(QueryKey key, Set<String> spaces, SharedSessionContractImplementor session) throws HibernateException
Attempt to retrieve a cached query result list for the givenQueryKeyfrom the cache region, and then check if the cached results, if any, are stale. If there is no cached result list for the given key, or if the cached results are stale, returnnull.- Parameters:
key- The cache key uniquely identifying the query and its bound parameter argumentsspaces- The query spaces which affect the results of the query (used to check if cached results are stale)session- The originating session- Returns:
- The cached results; may be null if there are no cached results for the given key, or if the results are stale.
- Throws:
HibernateException- Indicates a problem delegating to the underlying cache.
-
get
List<?> get(QueryKey key, String[] spaces, SharedSessionContractImplementor session) throws HibernateException
Attempt to retrieve a cached query result list for the givenQueryKeyfrom the cache region, and then check if the cached results, if any, are stale. If there is no cached result list for the given key, or if the cached results are stale, returnnull.- Parameters:
key- The cache key uniquely identifying the query and its bound parameter argumentsspaces- The query spaces which affect the results of the query (used to check if cached results are stale)session- The originating session- Returns:
- The cached results; may be null.
- Throws:
HibernateException- Indicates a problem delegating to the underlying cache.
-
clear
default void clear() throws CacheExceptionClear all items from this query result cache.- Throws:
CacheException- Indicates a problem delegating to the underlying cache.
-
destroy
default void destroy()
-
-