`
learnmore
  • 浏览: 589474 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

ibatis缓存

阅读更多
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秒之后刷新缓存的目的.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics