`
xulongfa
  • 浏览: 70032 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

ibatis Tips 之 cacheModel

阅读更多

cacheModel的属性值等于指定的cacheModel元素的name属性值。属性cacheModel定义查询mapped statement的缓存。每一个查询mapped statement可以使用不同或相同的cacheModel。

<cacheModel id="product-cache"  imlementation="LRU">
      <flushInterval hours="24"/>
      <flushOnExecute  statement="insertProduct"/>
      <flushOnExecute  statement="updateProduct"/>
      <flushOnExecute  statement="deleteProduct"/>
     <property name=”size” value=”1000” />
</cacheModel>
<statement  id=”getProductList”  parameterClass=”int” 
                    cacheModel=”product-cache”>
        select * from PRODUCT where PRD_CAT_ID = #value#
</statement>

 

上面例子中,“getProductList”的缓存使用WEAK引用类型,每24小时刷新一次,或当更新的操作发生时刷新。

 

下面的内容转自javaeye 作者:lggege  引用地址:http://lggege.iteye.com/blog/216615

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics