ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meindert" <meind...@pastelebusiness.com>
Subject RE: Cache object reference
Date Wed, 06 Jun 2007 12:07:41 GMT
Ah! Excellent that is better then cloning the result object! Thanks!

Must say though, I don't understand the whole caching..
> In your cache definition, you have readonly="true", but are not
> modifying the results. You are a very bad boy. Don't do that. :-)
Readonly="true" is the default so I thought that is the 'normal' setting
I have a readonly cache and are only reading (not modifying) the result,
sounds right doesn't it?
I also tried Readonly="false" but this (without serializable=true) did not
'fix' the issue.

I flush the cache when I do an update. And therefore don't need to write to
the cache? Am I misusing the cache functionality in this way?

The example on page 42 of the developer guide states readOnly="true"
serialize="false", this is a bad configuration?

> because results will only be cached for the current iBATIS 'session'
I'm running iBATIS in a web application, isn't there only one iBATIS
'session'? (When I start the web application for the first time)

Kind Regards
 Meindert


-----Original Message-----
From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf Of
Larry Meadors
Sent: 06 June 2007 01:00 PM
To: user-java@ibatis.apache.org
Subject: Re: Cache object reference

On 6/6/07, Meindert <meindert@pastelebusiness.com> wrote:
> Is it by design that the object returned from the cache has the same
object
> reference as the on in the cache?

Yes, it is. This is intended to be a performance enhancing tweak for
the brave, but in your case it is a misconfiguration.

In your cache definition, you have readonly="true", but are not
modifying the results. You are a very bad boy. Don't do that. :-)

If you set serializable="true" and readonly="false" then the object is
copied before being returned from the cache - assuming that the cached
objects are serializable - if they are not, KABOOM!

Note: If you set serializable="false" and readonly="false", you will
lose a lot of caching benefits, because results will only be cached
for the current iBATIS 'session', which is in 99.999% of cases, not
what you want. Don't do that either. :-)

Larry


Mime
View raw message