package

org.hibernate.cache

This package defines APIs/SPIs and implementations for the Hibernate second-level cache.

The legacy (and now deprecated) approach to caching is defined by the CacheProvider and Cache interfaces as well as the CacheConcurrencyStrategy interface along with the various implementations of all these interfaces. In that scheme, a CacheProvider defined how to configure and perform lifecycle operations in regards to a particular underlying caching library; it also defined how to build Cache instances which in turn defined how to access the "regions" of the underlying cache instance. For entity and collection data cache regions, CacheConcurrencyStrategy wrapped access to those cache regions to apply transactional/concurrent access semantics.

The improved approach is based on RegionFactory, the various Region specializations and the two access strategies contracts (EntityRegionAccessStrategy and CollectionRegionAccessStrategy). The general approach here is that RegionFactory defined how to configure and perform lifecycle operations in regards to a particular underlying caching library (or libraries). RegionFactory also defines how to build specialized Region instances based on the type of data we will be storing in that given region. The fact that RegionFactory is asked to build specialized regions (as opposed to just general access) is the first improvement over the legacy scheme. The second improvement is the fact that the regions (well the ones like entity and collection regions that are responsible for storing transactional data) are asked to build their own access strategies (see buildAccessStrategy(AccessType) and buildAccessStrategy(AccessType)).

Interfaces

Cache This interface is deprecated. As of 3.3; see for details.  
CacheConcurrencyStrategy This interface is deprecated. As of 3.3; see for details.  
CacheDataDescription Describes attributes regarding the type of data to be cached. 
CacheProvider This interface is deprecated. As of 3.3; see for details.  
CollectionRegion Defines the contract for a cache region which will specifically be used to store collection data. 
EntityRegion Defines the contract for a cache region which will specifically be used to store entity data. 
GeneralDataRegion Contract for general-purpose cache regions. 
OptimisticCache A contract for transactional cache implementations which support optimistic locking of items within the cache. 
OptimisticCacheSource Contract for sources of optimistically lockable data sent to the second level cache. 
QueryCache Defines the contract for caches capable of storing query results. 
QueryCacheFactory Defines a factory for query cache instances. 
QueryResultsRegion Defines the contract for a cache region which will specifically be used to store query results. 
ReadWriteCache.Lockable  
Region Defines a contract for accessing a particular named region within the underlying cache implementation. 
RegionFactory Contract for building second level cache regions. 
TimestampsRegion Defines the contract for a cache region which will specifically be used to store entity "update timestamps". 
TransactionalDataRegion Defines contract for regions which hold transactionally-managed data. 
TransactionAwareCache Marker interface for identifying cache impls which are aware of JTA transactions 

Classes

AbstractJndiBoundCacheProvider Support for CacheProvider implementations which are backed by caches bound into JNDI namespace. 
CacheKey Allows multiple entity classes / collection roles to be stored in the same cache region. 
FilterKey Allows cached queries to be keyed by enabled filters. 
HashtableCache A lightweight implementation of the Cache interface 
HashtableCacheProvider A simple in-memory Hashtable-based cache impl. 
NoCacheProvider Implementation of NoCacheProvider. 
NonstrictReadWriteCache Caches data that is sometimes updated without ever locking the cache. 
QueryKey A key that identifies a particular query with bound parameter values. 
ReadOnlyCache Caches data that is never updated. 
ReadWriteCache Caches data that is sometimes updated while maintaining the semantics of "read committed" isolation level. 
ReadWriteCache.Item An item of cached data, timestamped with the time it was cached,. 
ReadWriteCache.Lock A soft lock which supports concurrent locking, timestamped with the time it was released 
StandardQueryCache The standard implementation of the Hibernate QueryCache interface. 
StandardQueryCacheFactory Standard Hibernate implementation of the QueryCacheFactory interface. 
Timestamper Generates increasing identifiers (in a single VM only). 
TransactionalCache Support for fully transactional cache implementations like JBoss TreeCache. 
UpdateTimestampsCache Tracks the timestamps of the most recent updates to particular tables. 

Exceptions

CacheException Something went wrong in the cache  
NoCachingEnabledException Implementation of NoCachingEnabledException.