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 Darren Davison <da...@davisononline.org> on 2008/07/11 08:40:33 UTC

caching and obect refs

just out of interest, how do people handle the sharing of object refs
from an ibatis cache?

If I cache a reference to a Product instance and a second user obtains
that reference from the cache, the cache will effectively be tainted by
any transient modification that user makes to the instance. i.e. even if
the user would have no rights to persist those changes.

What do others do - not cache anything other than immutable classes? 
manage caches on a per user basis?  Something else altogether?

Cheers,

-- 
Darren Davison
Public Key: 0xE855B3EA

Re: caching and obect refs

Posted by Darren Davison <da...@davisononline.org>.
On Fri, Jul 11, 2008 at 07:18:35AM -0600, Larry Meadors wrote:
> Make it read-only and serializable.

thanks Larry.. I re-read the docs and understand what the serialization
is giving me now :)

So, given that we have heavy usage of lazy-loading, and result sets that
are much more heavily read than written, how best to cache these?  Does
a non-serializable, read-write cache really offer much in the way of
benefit?

Cheers,

-- 
Darren Davison
Public Key: 0xE855B3EA

Re: caching and obect refs

Posted by Larry Meadors <la...@gmail.com>.
Make it read-only and serializable.

Larry


On Fri, Jul 11, 2008 at 12:40 AM, Darren Davison
<da...@davisononline.org> wrote:
> just out of interest, how do people handle the sharing of object refs
> from an ibatis cache?
>
> If I cache a reference to a Product instance and a second user obtains
> that reference from the cache, the cache will effectively be tainted by
> any transient modification that user makes to the instance. i.e. even if
> the user would have no rights to persist those changes.
>
> What do others do - not cache anything other than immutable classes?
> manage caches on a per user basis?  Something else altogether?
>
> Cheers,
>
> --
> Darren Davison
> Public Key: 0xE855B3EA
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIdwBhVgOfSOhVs+oRAtiqAJkBRXc66yDXWQQU1cZ5EE7Q5ucBowCeOT+C
> EXyaf0KFoByfTwwVuoRtrUs=
> =pfE5
> -----END PGP SIGNATURE-----
>
>