ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Sorensen" <bsoren...@idtdna.com>
Subject Cache not working
Date Wed, 27 Dec 2006 17:03:10 GMT
I'm evaluating iBATIS, and have been unable to get the cache to work.

Relevant map sections:
		<cacheModel id="OrderCache" implementation="LRU"
			<flushInterval hours="24"/>
			<property name="CacheSize" value="1000" />

		<select id="Retrieve" parameterClass="int"
resultMap="OrderResult" cacheModel="OrderCache">

Relevant code section (just test code):

			MessageBox.Show("Insure cache is on and turn on

			ISqlMapper sqlMap = Mapper.Instance();

			using (IDalSession session =
				Order ord =
sqlMap.QueryForObject<Order>("OrderMap.Retrieve", 6400048);
				Order ord2 =
sqlMap.QueryForObject<Order>("OrderMap.Retrieve", 258474);

				MessageBox.Show("About to reload orders
from cache...");

				Order ord3 =
sqlMap.QueryForObject<Order>("OrderMap.Retrieve", 6400048);
				Order ord4 =
sqlMap.QueryForObject<Order>("OrderMap.Retrieve", 258474);

				ord.OrderId = ord.OrderId;


Using SQL Server Profiler, I can see the two SQL calls for the initial
retrieves.  After the "reload" message, I get the same two SQL calls.
Nothing's cached.

I've tried LRU and MEMORY, readOnly false and true, etc. - nothing seems
to make any difference.

Thanks in advance,
Bill Sorensen

View raw message