iBatis for .NET
  1. iBatis for .NET
  2. IBATISNET-299

Read/write, nonserializable caching generates a new cache key for each request


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: DataMapper 1.6.2
    • Fix Version/s: None
    • Component/s: DataMapper
    • Labels:


      Read/write, nonserializable caching appears not to work because consecutive calls from the same thread to a SELECT statement with such a cache model return different objects.

      Inspecting the logs reveals that this is because each request gets a new cache key, even though the SQL is identical.

      There is an archived email thread about this issue here: http://www.mail-archive.com/user-cs@ibatis.apache.org/msg02271.html In that thread, Gilles indicates that he checked in a test and it worked; however that test does not expose the issue because it does not use a read/write, nonserializable cache model.

      Steps to reproduce:

      1) Set up a SQL Map with a read/write, nonserializable cache model and a SELECT statement that uses it (example below)
      2) Write a test that calls the statement twice in a row using one of the ISqlMapper QueryForXYZ() methods
      3) Run the test with debug logging enabled. Examine the log and note that both statements result in cahce misses using different cache keys

      SQL Map snippets:

      <cacheModel id="rw-nonserializable-account-cache" implementation="FIFO" serialize="false" readOnly="false">
      <flushInterval hours="24"/>
      <flushOnExecute statement="UpdateAccountViaInlineParameters"/>
      <select id="GetRWNSCachedAccountsViaResultMap"
      cacheModel="rw-nonserializable-account-cache" extends="GetCachedAccountsViaResultMap">


        Steven Cottrell created issue -
        Steven Cottrell made changes -
        Field Original Value New Value
        Attachment RWNS_caching_fix.patch [ 12431596 ]


          • Assignee:
            Steven Cottrell
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: