Print Page | Close Window

Caching Question

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=194
Printed Date: 16-May-2025 at 3:38am


Topic: Caching Question
Posted By: Customer
Subject: Caching Question
Date Posted: 12-Jul-2007 at 3:17pm
I�m finally getting to the point that some basic testing is occurring on some of the UI code we have been creating.  During this testing, I�m finding something I guess I just don�t understand and am curious of what the best practice should be for caching.

Scenario:

I have list of items in the query cache for specific query, I may update this list or just view it.  While I�m on this UI, I go to the DB and say add, update or delete a row.  Let�s say I add one that should appear on this list the next time I query the data base.  I use the normal query strategy, and after I refresh by calling the same query, the new row never appears until I shutdown the app and re-load it.  Obviously, I�m missing something here.  I assume using the database query strategy that my cache is always refreshed directly from the backend and that would solve it but then I wouldn�t get a benefit of the caching?  Can you tell me how this should be done in the real world to offer the best performance and accuracy?




Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 3:17pm
I suspect that what is going on here is that the query you are using has been cached.  When you make the query after you have modified the database (presumably by doing something like opening up SQL Server Management Studio and manually adding a new row), the PersistenceManager sees your query in the query cache and gets the items from the PersistenceManager cache.
 
If you want to see the new changes, you should use a QueryStrategy of DataSourceOnly, that will override the fact that the query is in the QueryCache.



Print Page | Close Window