Top Description Inners Fields Constructors Methods
org.hibernate.cache.internal

public Class QueryResultsCacheImpl

extends Object
implements QueryResultsCache
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.spi.QueryResultsCache
Imports
java.io.Serializable, java.util.ArrayList, .List, .Set, org.hibernate.HibernateException, org.hibernate.cache.spi.QueryKey, .QueryResultsCache, .QueryResultsRegion, .TimestampsCache, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.event.spi.EventManager, .HibernateMonitoringEvent

The standard implementation of the Hibernate QueryCache interface. Works hind-in-hand with TimestampsCache to help in recognizing stale query results.
Authors
Gavin King, Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final QueryResultsRegion
private final TimestampsCache

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static <T> List<T>
deepCopy(List<T> results)

public List<?>
get(final QueryKey
The cache key uniquely identifying the query and its bound parameter arguments
key
,
final Set<String>
The query spaces which affect the results of the query (used to check if cached results are stale)
spaces
,
final SharedSessionContractImplementor
The originating session
session
)

Implements org.hibernate.cache.spi.QueryResultsCache.get.

Attempt to retrieve a cached query result list for the given QueryKey from the cache region, and then check if the cached results, if any, are stale.
public List<?>
get(final QueryKey
The cache key uniquely identifying the query and its bound parameter arguments
key
,
final String[]
The query spaces which affect the results of the query (used to check if cached results are stale)
spaces
,
final SharedSessionContractImplementor
The originating session
session
)

Implements org.hibernate.cache.spi.QueryResultsCache.get.

Attempt to retrieve a cached query result list for the given QueryKey from the cache region, and then check if the cached results, if any, are stale.
private QueryResultsCacheImpl.CacheItem
public QueryResultsRegion
getRegion()

Implements org.hibernate.cache.spi.QueryResultsCache.getRegion.

The underlying cache region being used.
public boolean
put(final QueryKey
The cache key uniquely identifying the query and its bound parameter arguments
key
,
final List<?>
The result list to cache
results
,
final SharedSessionContractImplementor
The originating session
session
)

Implements org.hibernate.cache.spi.QueryResultsCache.put.

Store a result list of a query with the given QueryKey in the query result cache.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cacheRegionback to summary
private final QueryResultsRegion cacheRegion
timestampsCacheback to summary
private final TimestampsCache timestampsCache

Constructor Detail

QueryResultsCacheImplback to summary
pack-priv QueryResultsCacheImpl(QueryResultsRegion cacheRegion, TimestampsCache timestampsCache)

Method Detail

deepCopyback to summary
private static <T> List<T> deepCopy(List<T> results)
getback to summary
public List<?> get(final QueryKey key, final Set<String> spaces, final SharedSessionContractImplementor session) throws HibernateException

Implements org.hibernate.cache.spi.QueryResultsCache.get.

Doc from org.hibernate.cache.spi.QueryResultsCache.get.

Attempt to retrieve a cached query result list for the given QueryKey from 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, return null.

Parameters
key:QueryKey

The cache key uniquely identifying the query and its bound parameter arguments

spaces:Set<String>

The query spaces which affect the results of the query (used to check if cached results are stale)

session:SharedSessionContractImplementor

The originating session

Returns:List<?>

The cached results; may be null if there are no cached results for the given key, or if the results are stale.

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem delegating to the underlying cache.
getback to summary
public List<?> get(final QueryKey key, final String[] spaces, final SharedSessionContractImplementor session) throws HibernateException

Implements org.hibernate.cache.spi.QueryResultsCache.get.

Doc from org.hibernate.cache.spi.QueryResultsCache.get.

Attempt to retrieve a cached query result list for the given QueryKey from 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, return null.

Parameters
key:QueryKey

The cache key uniquely identifying the query and its bound parameter arguments

spaces:String[]

The query spaces which affect the results of the query (used to check if cached results are stale)

session:SharedSessionContractImplementor

The originating session

Returns:List<?>

The cached results; may be null.

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem delegating to the underlying cache.
getCachedDataback to summary
private QueryResultsCacheImpl.CacheItem getCachedData(QueryKey key, SharedSessionContractImplementor session)
getRegionback to summary
public QueryResultsRegion getRegion()

Implements org.hibernate.cache.spi.QueryResultsCache.getRegion.

Doc from org.hibernate.cache.spi.QueryResultsCache.getRegion.

The underlying cache region being used.

Annotations
@Override
putback to summary
public boolean put(final QueryKey key, final List<?> results, final SharedSessionContractImplementor session) throws HibernateException

Implements org.hibernate.cache.spi.QueryResultsCache.put.

Doc from org.hibernate.cache.spi.QueryResultsCache.put.

Store a result list of a query with the given QueryKey in the query result cache.

Parameters
key:QueryKey

The cache key uniquely identifying the query and its bound parameter arguments

results:List<?>

The result list to cache

session:SharedSessionContractImplementor

The originating session

Returns:boolean

Whether the put actually happened.

Annotations
@Override
Exceptions
HibernateException:
Indicates a problem delegating to the underlying cache.
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.hibernate.cache.internal back to summary

public Class QueryResultsCacheImpl.CacheItem

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
private final List<?>
private final Long

Constructor Summary

AccessConstructor and Description
pack-priv
CacheItem(long timestamp, List<?> results)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resultsback to summary
private final List<?> results
timestampback to summary
private final Long timestamp

Constructor Detail

CacheItemback to summary
pack-priv CacheItem(long timestamp, List<?> results)