Menu

Caching question

2003-07-03
2003-07-10
  • Nobody/Anonymous

    just wondering if the caching would be very clever to know that SELECT * FROM ACCOUNT ORDER BY clientName and SELECT * FROM ACCOUNT ORDER BY clientNumber are the same SQL statement, just different sorting option?  Or should I query for results without sorting option, and do the sorting myself?

     
    • Clinton Begin

      Clinton Begin - 2003-07-03

      Hi,

      The statement will be considered different and therefore the cache will distinguish between them.  So yes, if you want it to be cached only once, you should query without the sort and sort using the Collections class with a Comparator implementation.

      (The framework never parses SQL directly, which is why it works with any database.)

      Cheers,
      Clinton

       
    • Nobody/Anonymous

      Do I need to use threading to take advantage of the the caching facility?  Thanks

       
    • Clinton Begin

      Clinton Begin - 2003-07-10

      Hi,

      Not sure what you mean by that.  But the answer is: yes you _can_ use multiple threads and the cache will deal with them.  But caching will also work if only one thread ever uses it.

      Cheers,
      Clinton

       

Log in to post a comment.