Skip navigation links

Package org.hibernate.cache

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

See: Description

Package org.hibernate.cache Description

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 EntityRegion.buildAccessStrategy(org.hibernate.cache.access.AccessType) and CollectionRegion.buildAccessStrategy(org.hibernate.cache.access.AccessType)).

Skip navigation links

Copyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved