首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

hiberante二级缓存1(配置)

2012-10-17 
hiberante二级缓存一(配置)都说hibernate的二级缓存用处比较大,在一年前的一个项目时就打算使用hibernate

hiberante二级缓存一(配置)
都说hibernate的二级缓存用处比较大,在一年前的一个项目时就打算使用hibernate的二级缓存,但时常碰到脏读又没时间进行分析和处理,后来决定项目取消了对二级缓存的使用。  前不久公司发钱请了红帽的高级架构师进行培训,再三强调二级缓存的作用。。。今天终于下定决心进行了一些测试。首先进行hibernate的二级缓存配置
第一步:.hibernate.cfg.xml 配置文件



第二步:定义Attachment.hbm.xml 在xml开始部分定义二级缓存


第三步:定义ehcache.xml文件
<ehcache>    <diskStore path="c:\\ehcache"/>    <defaultCache        maxElementsInMemory="10000"        eternal="false"        timeToIdleSeconds="120"        timeToLiveSeconds="120"        overflowToDisk="true"        />    <cache name="com.going.oa.model.Attachment"        maxElementsInMemory="10000"        eternal="false"        timeToIdleSeconds="300"        timeToLiveSeconds="600"        overflowToDisk="true"        />  </ehcache>

热点排行