Brandon,
I am happy with your response. Yes, I am trying to address a current
failure in extensibility. I could do something with the RowHandler,
except it's the wrong point in the lifecycle of the data mapper. A
RowHandler gives you back an object -- but this is not ideal since I
need to first determine if I have the object already. So in theory I am
wasting memory and time to create objects I most likely will be tossing
away.
You could add to IBATIS this way:
* Allow me to attach a cache at the resultMap level.
* Add a @key attribute to a resultMap. This would flag one or multiple
properties as being a primary key, and then ibatis could then, if a
cache is present, check if an object already exists.
<resultMap id="roleMap" cacheModel="roleObjectCache">
...
</resultMap>
* Add some other feature to allow flushing of a single object from the
object cache.
And Tom Duffey writes:
>> Jumping in a little late here but I do exactly this, and I use
iBATIS *and*
>> I don't require any new iBATIS features. It's pretty simple:
>> - Turn off iBATIS caching
>> - Build a Factory layer that sites right about your iBATIS layer
>> - Use something like ehcache, oscache, etc. in your factories along
with
>> some simple methods to ensure object identity
I already do this :-) I front my DAOs with a layer and use OSCache.
However, this can get very tedious and tough to manage as the # of my
DAOs grow. If this kind of caching at the object level can be built
straight into ibatis, life would be easier.
Paul