I did get the cache to work - sort of.  Read/write caches appear to be
broken in v1.5.1.


<cacheModel id="OrderCache" implementation="LRU" readOnly="false"
serialize="true">

causes the following error:

IBatisNet.Common.Exceptions.IBatisNetException: Error caching
serializable object. Cause: Type
'IBatisNet.Common.Utilities.Objects.Members.DelegatePropertySetAccessor'
in Assembly 'IBatisNet.Common, Version=1.4.1.0, Culture=neutral,
PublicKeyToken=ed781d9fc396c6ca' is not marked as serializable. 


readOnly="false" serialize="false" - no errors, but did not cache (per
SQL Server Profiler)


readOnly="true" serialize="false" - worked (cached)


Can anyone confirm these issues, or offer suggestions?

As a side note, I turned on logging for the cache:

<logger name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
  <level value="DEBUG" />
</logger>

but nothing was logged by that logger.  The closest I found in the logs
was:

DEBUG IBatisNet.DataMapper.Configuration.DomSqlMapBuilder - Registering
trigger statement [OrderMap.Create] to cache model [OrderMap.OrderCache]

I had hoped for something along the lines of Gentle.NET:

Debug: Cache (get) using key: PersistTest_Gentle.Order|select
PT_Order_ID, Order_Notes, PT_Customer_ID from PT_Order where PT_Order_ID
= @PT_Order_ID;|@PT_Order_ID=6400048 (miss)

Is there any way to enable cache logging at this level?

Thanks,
Bill Sorensen


-----Original Message-----
From: Bill Sorensen 
Sent: Wednesday, December 27, 2006 11:03 AM
To: [email protected]
Subject: Cache not working

I'm evaluating iBATIS, and have been unable to get the cache to work.

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

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

Relevant code section (just test code):

                        MessageBox.Show("Insure cache is on and turn on
tracing");

                        ISqlMapper sqlMap = Mapper.Instance();

                        using (IDalSession session =
sqlMap.OpenConnection())
                        {
                                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;
                        }

                        MessageBox.Show("Done.");

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

Reply via email to