ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Apesa" <vap...@hotmail.com>
Subject Re: Caching and thread safety
Date Tue, 27 Jan 2009 23:15:58 GMT
Take a look at the documentation. The documentation examples make use of a 
singleton ISqlMapper that is available via a base data access class.
This should solve your problem.

Vince

----- Original Message ----- 
From: "Iskan Der" <alex.v.kiselev@gmail.com>
To: <user-cs@ibatis.apache.org>
Sent: Tuesday, January 27, 2009 1:17 AM
Subject: Caching and thread safety


>
> Hello, everyone.
>
> Pardon me, if my questions look stupid, but I'm new to iBatis.
> So, I'm going to implement my own SiteMapProvider for a tree of 
> categories,
> stored in database. Since categories list does not change too often, I
> believe that caching would quite useful here.
> However, there are some things I would like to clarify:
> 1. I guess, cache is controlled by an ISqlMapper instance, which was used
> for retrieving entities from DB. So, having once obtained that instance, I
> should keep it for the whole application lifetime (probably, using some 
> kind
> of a singleton), right?
> 2. ISqlMapper instance members do not seem to be thread-safe. So, if I 
> have
> single ISqlMapper to control the cache, I need to call all its methods
> inside lock(...) { } blocks. However, I don't like that many locks in my
> code. Maybe someone knows more elegant solution?
>
> Anyway, if anyone has experience in implementing similar things, please
> share your thoughts. Thanks in advance.
> -- 
> View this message in context: 
> http://www.nabble.com/Caching-and-thread-safety-tp21680257p21680257.html
> Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.
>
> 


Mime
View raw message