Caching iBATIS缓存不会在给定语句上刷新
我正在使用iBatis进行数据库交互。最近,我试图通过配置缓存来提高一些静态数据获取的性能。chache已配置并正常工作,但问题在于每当对缓存数据进行任何插入/更新/删除时,都会刷新该数据。我对类别表进行了以下配置 现在的问题是,即使执行insertCategory/updateCategory/deleteCategory语句,缓存也不会被刷新。它维护插入/更新/删除之前选择的数据Caching iBATIS缓存不会在给定语句上刷新,caching,ibatis,Caching,Ibatis,我正在使用iBatis进行数据库交互。最近,我试图通过配置缓存来提高一些静态数据获取的性能。chache已配置并正常工作,但问题在于每当对缓存数据进行任何插入/更新/删除时,都会刷新该数据。我对类别表进行了以下配置 现在的问题是,即使执行insertCategory/updateCategory/deleteCategory语句,缓存也不会被刷新。它维护插入/更新/删除之前选择的数据 请告诉我哪里出了问题。尝试将缓存设置为readOnly=false-从文档: 该框架支持两种只读模式 和读/
请告诉我哪里出了问题。尝试将缓存设置为readOnly=false-从文档: 该框架支持两种只读模式 和读/写缓存。只读 缓存在所有用户和用户之间共享 因此,提供更高的性能 利益但是,对象从 只读缓存不应为空 被改进的。相反,应该创建一个新对象 可以从数据库或 用于更新的读/写缓存。上 另一方面,如果有意图的话 使用对象进行检索和 修改后,将创建读/写缓存 建议的,即要求的。使用 只读缓存,设置readOnly=“true” 在缓存模型元素上。使用 读/写缓存,设置 readOnly=“false”。默认值是 只读正确
我不知道这是否有什么区别,但是size属性不应该命名为cache size吗?我不是iBatis专家,可能是错的:我尝试使用缓存大小,但它不起作用
<cacheModel type="LRU" id="categoryCache" readOnly="true" serialize="false">
<flushOnExecute statement="insertCategory"/>
<flushOnExecute statement="updateCategory"/>
<flushOnExecute statement="deleteCategory"/>
<property name="size" value="1000"/>
</cacheModel>
<insert id="insertCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
insert into categories (code, description)
values(#code:VARCHAR#,#description:VARCHAR#)
</insert>
<update id="updateCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
update categories set description=#description:VARCHAR# where code=#code:VARCHAR#
</update>
<delete id="deleteCategory"
parameterClass="com.uniplas.entity.master.beans.CategoryVO">
delete from categories where code=#code:VARCHAR#
</delete>
<select id="selectCategory" resultMap="categoryResult"
parameterClass="java.util.Map" cacheModel="categoryCache">
select * from categories where 1=1
<dynamic>
<isNotEmpty property="categoryVO.code">
and code like #categoryVO.code:VARCHAR#
</isNotEmpty>
<isNotEmpty property="categoryVO.description">
and description like
#categoryVO.description:VARCHAR#
</isNotEmpty>
<isNotEmpty property="orderBy">
order by $orderBy$
</isNotEmpty>
</dynamic>
</select>