论坛首页 Java企业应用论坛

ibatis缓存

浏览 2171 次
锁定老帖子 主题:ibatis缓存
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-09-04  
1.首先在sqlmapconfig.xml中加入
<settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
        />
2.在sql.xml中加入
<cacheModel   id="hotwordCache"   readOnly="true" type="LRU" serialize="true">
<!--when the data has changed we flush the cache-->
<flushInterval seconds="60"/> ---如果想要在60秒后刷新缓存,必须把type设    为"LRU"
<flushOnExecute statement="inserthotword"/>----当进行增,删,改的时候刷新缓存
<flushOnExecute statement="hotworddel"/>
<property name="size" value="1000" />
<property name="reference-type" value="WEAK" />
</cacheModel>

3.我开始type配的属性为"MEMORY",每次数据库的操作都是直接反应出来,没有经过缓存,后来把type改为"LRU"才能实现从缓存中取数据,60秒之后刷新缓存的目的.

论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics