I'd love to, but we just started playing with iBatis and have only
worked with memory caching a little, so I'm not much help.

  _____  

From: Sara O'Neal [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 9:22 PM
To: [email protected]
Subject: RE: Question about Caching in iBatis .NET


So no one can help me with this problem or tell me if it is a bug?
 
thanks,
Sara

  _____  

From: Sara O'Neal 
Sent: Wednesday, February 14, 2007 7:51 PM
To: [email protected]
Subject: Question about Caching in iBatis .NET


I am new to iBatis, and have been playing around with the caching
feature.  I'm not sure if I am doing something wrong, or if it is
working incorrectly.  I am trying to use the FIFO caching model in
iBatis .NET, DataMapper 1.5.1, using SQL Server 2005.  Here is my model:
 
<cacheModels>
    <cacheModel id="addressCacheF" implementation="FIFO">
        <flushInterval hours="24" />
        <flushOnExecute statement="InsertAddress" />
        <flushOnExecute statement="UpdateAddress" />
        <property name="CacheSize" value="5" />
    </cachModel>
</cacheModels>
 
I also have caching enabled:
 
<settings>
         <setting useStatementNamespaces="true" />
         <setting cacheModelsEnabled="true" />
         <setting validateSqlMap="true" />
</settings>
 
Please excuse any errors, because I retyped this.  So, from what I
understand, this is using a First in First Out algorithm for caching and
it caches a Maximum of 5 items.  However, when I apply this cache model
to the code that I wrote, it doesn't seem to work correctly.  I am using
SQL Server Profiler to trace any database events (I also enabled logging
for iBatis to track cache hits/misses).  The data I am retrieving is
from a table of clients, and I am retrieving the client by a client id.
The sequence I am using is:
 
1, 2, 3, 4, 5
 
For this sequence there are 5 cache misses and all 5 should now be in
the cache.  Next, I use the same sequence and get 5 cache hits.  Both
the log and the profiler back this up.
 
Then, I enter 6 and get a cache miss.  This means 2 things.  First, 6 is
going to be added to the cache.  Second, since the cache is full, it
uses FIFO to replace the first item in the cache, which was 1.  So, I
can now enter this sequence:
 
2, 3, 4, 5, 6
 
Sure enough, I get 5 cache hits.  Next, I want to go back to 1.  When I
enter that value, I should get a miss, and indeed do.  It should also
add the object to the cache, mean I should have:  3, 4, 5, 6, 1 in my
cache.  BUT, it doesn't, I still have 2, 3, 4, 5, 6 in my cache.  More
than that, though, when I try 7, it gets added to the cache, but none of
the other objects get replaced!  I can add 8, 9, 10, 11...getting misses
on each the first time.  However, I can then go back and try 2, 3, 4, 5,
6, 7, 8, 9, 10, 11 and get hits on every single one of them.  Finally, I
try 1 again and get a miss...I continue trying and continue getting a
miss.
 
So, is there something I missing about the caching, or is there
something I not understanding about the cache size, or what?
 
I have tried using the other cache implementations as well.  I'm not
sure what the MEMORY is supposed to do...so I can't really tell if it is
working correctly or not.  The LRU, however, doesn't seem to work
correctly either, but that is a completely different story.  Please
advise if I should report this as a bug, or if I do not understand the
way it SHOULD work.
 
thanks,
Sara O'Neal
Software Developer, Cadre5, LLC
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
--------------------------------------------------------

Princeton Retirement Group, Inc - Important Terms 
This E-mail is not intended for distribution to, or use by, any person or 
entity in any location where such distribution or use would be contrary to law 
or regulation, or which would subject Princeton Retirement Group, Inc. or any 
affiliate to any registration requirement within such location. 
This E-mail may contain privileged or confidential information or may otherwise 
be protected by work product immunity or other legal rules. No confidentiality 
or privilege is waived or lost by any mistransmission. Access, copying or 
re-use of information by non-intended or non-authorized recipients is 
prohibited. If you are not an intended recipient of this E-mail, please notify 
the sender, delete it and do not read, act upon, print, disclose, copy, retain 
or redistribute any portion of this E-mail. 
The transmission and content of this E-mail cannot be guaranteed to be secure 
or error-free. Therefore, we cannot represent that the information in this 
E-mail is complete, accurate, uncorrupted, timely or free of viruses, and 
Princeton Retirement Group, Inc. cannot accept any liability for E-mails that 
have been altered in the course of delivery. Princeton Retirement Group, Inc. 
reserves the right to monitor, review and retain all electronic communications, 
including E-mail, traveling through its networks and systems (subject to and in 
accordance with local laws). If any of your details are incorrect or if you no 
longer wish to receive mailings such as this by E-mail please contact the 
sender by reply E-mail. 

--------------------------------------------------------

Reply via email to