You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Yusuf <Yu...@ekalife.co.id> on 2006/02/20 02:44:15 UTC
Cache
Hi,
I was wondering about the cache feature in ibatis, i hope this isnt a
stupid question:
<cacheModel id="cache.references" type="LRU" readOnly="true"
serialize="false">
<flushInterval hours="8" />
<property name="cache-size" value="100" />
</cacheModel>
<select id="selectTest" resultClass="map"
cacheModel="cache.references">
select * from dual
</select>
I have a cache setting like above, but if i use log4j to log the query,
it seems that it always query again to database.. is there something
wrong with my config?
Thanks,
Yusuf S.
Re: Cache
Posted by Larry Meadors <lm...@apache.org>.
Yeah...this is almost a bug, but not quite..the assumption is that if
you have no parameters that the query must change based on something
else, so it doesn't get cached. :-/
A workaround (I think..) is to call the query with a parameter object
that you ignore.
Object o = sqlmap.queryForList("ns.query", "ignoreMe");
Larry
On 2/19/06, Yusuf <Yu...@ekalife.co.id> wrote:
> Hi,
> I was wondering about the cache feature in ibatis, i hope this isnt a
> stupid question:
>
> <cacheModel id="cache.references" type="LRU" readOnly="true"
> serialize="false">
> <flushInterval hours="8" />
> <property name="cache-size" value="100" />
> </cacheModel>
>
> <select id="selectTest" resultClass="map"
> cacheModel="cache.references">
> select * from dual
> </select>
>
> I have a cache setting like above, but if i use log4j to log the query,
> it seems that it always query again to database.. is there something
> wrong with my config?
>
> Thanks,
> Yusuf S.
>
>