Package org.hibernate.cache

This package defines Hibernate second level cache service.

See:
          Description

Interface Summary
RegionFactory Deprecated. Moved, but still need this definition for ehcache
 

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

Package org.hibernate.cache Description

This package defines Hibernate second level cache service. org.hibernate.cache.spi defines the SPI used to integrate with Hibernate internals.

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

The improved approach is based on RegionFactory, the various org.hibernate.cache.Region specializations and the two access strategies contracts (org.hibernate.cache.access.EntityRegionAccessStrategy and org.hibernate.cache.access.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 org.hibernate.cache.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 org.hibernate.cache.EntityRegion#buildAccessStrategy and org.hibernate.cache.CollectionRegion#buildAccessStrategy).



Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.