New Posts New Posts RSS Feed: Expire Query Cache
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Expire Query Cache

 Post Reply Post Reply
Author
kpinniger View Drop Down
Newbie
Newbie
Avatar

Joined: 10-Mar-2010
Location: Atlanta, GA USA
Posts: 7
Post Options Post Options   Quote kpinniger Quote  Post ReplyReply Direct Link To This Post Topic: Expire Query Cache
    Posted: 10-Mar-2010 at 6:20pm

Is there a setting on the EntityManager to remove an Entity from the cache after x amount of time?  Basically we know that the data might change during the day and we would like the cache to get invalidated after say 30 minutes. 

Thanks,
Kurt Pinniger
CDC Software
Back to Top
tooms View Drop Down
Newbie
Newbie
Avatar

Joined: 17-May-2011
Location: Brisbane
Posts: 4
Post Options Post Options   Quote tooms Quote  Post ReplyReply Direct Link To This Post Posted: 17-May-2011 at 3:06pm
I too would like to know if this is possible.
 
Our applications database can become quite large and on occassion a query may return 100k+ records which has a detremental affect on the system (performance and memory use) and we'd like a way to expire this cache.
 
Additionaly, is there a way to easily the number of entities returned and then intelligently decide if they should be cahced or not? Perhaps off the back of a dialogue box?
 
I'd also like to know how to appropriately clear the cache, is it enough to say QueryCache.Clear() and/or DataSet/Clear() .. ? I notice when I do this, no memory is freed up from the application.
 
Cheers,
Paul Twomey
MEX
Back to Top
robertg View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Mar-2011
Location: California
Posts: 87
Post Options Post Options   Quote robertg Quote  Post ReplyReply Direct Link To This Post Posted: 23-May-2011 at 5:17pm
KPinniger, there is no automatic way to do that, though you could certainly add a timestamp field to the entity, then before you use it, do a query to find and remove anything older than the desired period of time. (Alternately, you can just keep track of when your cache was generated, and replace the entire thing when the amount of time in question has passed.)
 
Paul, you may want to look into using a projection in order to limit the amount of data being returned to your client, so you are only transmitting/caching the entities that you're actually going to use. We have an article in the DRC which talks about doing this, http://drc.ideablade.com/xwiki/bin/view/Documentation/query-anonymous-projections.
 
Also, as to the Clear() functions; doing so should mark that memory as available for reclamation, when .NET does its garbage collection. If you use RemoveEntities() instead, it does so right away.


Edited by robertg - 23-May-2011 at 5:22pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down