ITeye博客

ibatis Tips 之 cacheModel

xulongfa · 2009-07-18 16:58 · ibatis · Cache · Blog · iBATIS · Markdown

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。