ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <lmead...@apache.org>
Subject Re: Ibatis caching Empty ResultSet
Date Sun, 10 Feb 2008 13:57:51 GMT
On Feb 10, 2008 1:25 AM, Serge Sozonoff <serge@sozonoff.com> wrote:
> > caches are generally agnostic about the content of the cache.
> Agreed, the cache can be agnostic about its content but then the real
> question is why is iBatis inserting an empty result set into the cache
> in the first place.

Hey, lighten up, I think I wrote that code. :-)

It's by design. Why wouldn't you cache it? It's every bit as valid as
a result set with data in it.

> > This would solve your issue and ensure that your cache is always in a
> > "clean" state.  I know you claim that this "makes no sense" but it
> > does :) As long as you are issues more then one select between inserts
> > which is normally the case.
> Yes I know that will fix the problem but its totally stupid to flush the
> entire cache upon insert of a new record.

Based on your comments, I don't think you understand how caching is
intended to work in iBATIS.

It's not an object cache, it's a query cache. We do not cache each
object, we cache query results.

What that means is that if you don't flush the entire cache on an
insert, you're pretty much hosing the entire cache.

In my experience, I have learned three things about caching:
1) Unless you are the only process that touches the database (rare for
me), caching of individual objects is of no value.
2) Caching for more than a few minutes is dangerous.
3) With a good database server with fast disk and enough RAM, a decent
connection pool, and optimized SQL, you can generally achieve adequate
performance with live data.

Larry

Mime
View raw message