Package org.hibernate.cache.internal
Class QueryResultsCacheImpl
- java.lang.Object
-
- org.hibernate.cache.internal.QueryResultsCacheImpl
-
- All Implemented Interfaces:
QueryResultsCache
public class QueryResultsCacheImpl extends Object implements QueryResultsCache
The standard implementation of the Hibernate QueryCache interface. Works hind-in-hand withTimestampsCacheto help in recognizing stale query results.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQueryResultsCacheImpl.CacheItem
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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<?> results, SharedSessionContractImplementor session)Store a result list of a query with the givenQueryKeyin the query result cache.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.cache.spi.QueryResultsCache
clear, destroy
-
-
-
-
Method Detail
-
getRegion
public QueryResultsRegion getRegion()
Description copied from interface:QueryResultsCacheThe underlying cache region being used.- Specified by:
getRegionin interfaceQueryResultsCache
-
put
public boolean put(QueryKey key, List<?> results, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:QueryResultsCacheStore a result list of a query with the givenQueryKeyin the query result cache.- Specified by:
putin interfaceQueryResultsCache- Parameters:
key- The cache key uniquely identifying the query and its bound parameter argumentsresults- 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
public List<?> get(QueryKey key, Set<String> spaces, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:QueryResultsCacheAttempt 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.- Specified by:
getin interfaceQueryResultsCache- 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
public List<?> get(QueryKey key, String[] spaces, SharedSessionContractImplementor session) throws HibernateException
Description copied from interface:QueryResultsCacheAttempt 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.- Specified by:
getin interfaceQueryResultsCache- 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.
-
-