ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Iskan Der <alex.v.kise...@gmail.com>
Subject Caching and thread safety
Date Tue, 27 Jan 2009 06:17:57 GMT

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.

View raw message