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