Today, look at the Hibernate cache interface svn hibernate3.3 source
Open the Cacheprovider Class A look at actually give @deprecated
It's a big heart.
Bad for Hibernate's level two cache and query cache long ago
Can only be set by entity configuration for a query statement
3.3 provides two interfaces Region Regionfactory to replace the cache in 3.2 Cacheprovider
Look at Regionfactory's realization.
Look at these methods, the names are so exciting.
Java code
buildCollectionRegion 对集合的缓存 猜测是对一对多的集合进行配置的吧
buildQueryResultsRegion 查询缓存 自定义的查询 也可以有自己的region了
buildTimestampsRegion 给缓存设置过期时间吧
English is bad guess English good can translate
GG on the search for a bit hibernate regionfactory keyword incredibly did not search
Doesn't everyone have a bad function?
Java code
public interface RegionFactory {
public void start(Settings settings, Properties properties) throws CacheException;
public void stop();
public boolean isMinimalPutsEnabledByDefault();
public long nextTimestamp();
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException;
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties) throws CacheException;
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties) throws CacheException;
}
Attach the instructions in the hibernate3.3 cache bag
Reference
This package defines Apis/spis and implementations for the Hibernate cache.
The legacy (and now deprecated) approach to caching are defined by the {@link Org.hibernate.cache.CacheProvider} and {@l Ink Org.hibernate.cache.Cache} interfaces as as the {@link Org.hibernate.cache.CacheConcurrencyStrategy} interface Along with the various implementations to all of the interfaces. In which scheme, a {@link org.hibernate.cache.CacheProvider} defined How-configure and perform lifecycle operations in R Egards to a particular underlying caching library; It also defined how to builds {@link Org.hibernate.cache.Cache} instances which in turn defined how to access the "regions" Of the underlying cache instance. For entity and collection The data cache regions, {@link Org.hibernate.cache.CacheConcurrencyStrategy} wrapped access to those Cache regions to apply transactional/concurrent access semantics.
The improved approach is based on {@link org.hibernate.cache.RegionFactory}, the various {@link org.hibernate.cache.Re Gion} specializations and the two access strategies contracts ({@link Org.hibernate.cache.access.EntityRegionAccessStrategy} and {@link Org.hibernate.cache.access.CollectionRegionAccessStrategy}). The general approach this is this {@link Org.hibernate.cache.RegionFactory} defined How to configure and perform lifecycle operations into regards to a particular UN Derlying Caching library (or libraries). {@link Org.hibernate.cache.RegionFactory} also defines how to build specialized {@link org.hibernate.cache.Region} Instances based on the type of data we'll be storing in that given region. The fact that {@link org.hibernate.cache.RegionFactory} are asked to builds specialized regions (as opposed to just general Access) is the "improvement over the legacy scheme." The second improvement is the fact of that regions (the OK the ones like entity and collection regionsare responsible for storing {@link org.hibernate.cache.TransactionalDataRegion transactional} data) are asked to build the IR own Access Strategies (@link Org.hibernate.cache.entityregion#buildaccessstrategy} and {@link Org.hibernate.cache.collectionregion#buildaccessstrategy}).