|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
学习JAVA的目的更多的是培养自身的工作能力,我觉得工作能力的一个核心就是:独立思考能力,因为只有独立思考后,才会有自己的见解
明天检察hibernatecache接口时svn了hibernate3.3的源码
翻开CacheProvider类一看竟然给@deprecated
真是年夜块民气
早就对hibernate的二级缓存和查询缓存不爽
只能依照实体设置不克不及针对某条查询语句设置
3.3的供应了两个接口Region RegionFactory来取代3.2中的CacheCacheProvider
看看RegionFactory的完成吧
看看这几个办法名字是何等的让人冲动
Java代码
buildCollectionRegion 对汇合的缓存 推测是对一对多的汇合举行设置的吧
buildQueryResultsRegion 查询缓存 自界说的查询 也能够有本人的region了
buildTimestampsRegion 给缓存设置过时工夫吧
英文欠好推测的英文好的能够翻译一下
在gg上搜刮了一下hibernateRegionFactory关头字竟然没搜刮到
岂非人人对个功效都不伤风
Java代码
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;
}
附上hibernate3.3cache包里的申明
援用
ThispackagedefinesAPIs/SPIsandimplementationsfortheHibernatesecond-levelcache.
Thelegacy(andnowdeprecated)approachtocachingisdefinedbythe{@linkorg.hibernate.cache.CacheProvider}and{@linkorg.hibernate.cache.Cache}interfacesaswellasthe{@linkorg.hibernate.cache.CacheConcurrencyStrategy}interfacealongwiththevariousimplementationsofalltheseinterfaces.Inthatscheme,a{@linkorg.hibernate.cache.CacheProvider}definedhowtoconfigureandperformlifecycleoperationsinregardstoaparticularunderlyingcachinglibrary;italsodefinedhowtobuild{@linkorg.hibernate.cache.Cache}instanceswhichinturndefinedhowtoaccessthe"regions"oftheunderlyingcacheinstance.Forentityandcollectiondatacacheregions,{@linkorg.hibernate.cache.CacheConcurrencyStrategy}wrappedaccesstothosecacheregionstoapplytransactional/concurrentaccesssemantics.
Theimprovedapproachisbasedon{@linkorg.hibernate.cache.RegionFactory},thevarious{@linkorg.hibernate.cache.Region}specializationsandthetwoaccessstrategiescontracts({@linkorg.hibernate.cache.access.EntityRegionAccessStrategy}and{@linkorg.hibernate.cache.access.CollectionRegionAccessStrategy}).Thegeneralapproachhereisthat{@linkorg.hibernate.cache.RegionFactory}definedhowtoconfigureandperformlifecycleoperationsinregardstoaparticularunderlyingcachinglibrary(orlibraries).{@linkorg.hibernate.cache.RegionFactory}alsodefineshowtobuildspecialized{@linkorg.hibernate.cache.Region}instancesbasedonthetypeofdatawewillbestoringinthatgivenregion.Thefactthat{@linkorg.hibernate.cache.RegionFactory}isaskedtobuildspecializedregions(asopposedtojustgeneralaccess)isthefirstimprovementoverthelegacyscheme.Thesecondimprovementisthefactthattheregions(welltheoneslikeentityandcollectionregionsthatareresponsibleforstoring{@linkorg.hibernate.cache.TransactionalDataRegiontransactional}data)areaskedtobuildtheirownaccessstrategies(see{@linkorg.hibernate.cache.EntityRegion#buildAccessStrategy}and{@linkorg.hibernate.cache.CollectionRegion#buildAccessStrategy}).
但是对于JAVA技术类的学习,我觉得大课堂反而会影响自身独立思考的过程,因为上课的时候,老师讲课的速度很快为了不遗漏要点,通常会仔细的听, |
|