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 2: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


Edited by kpinniger - 10-Mar-2010 at 2:21pm
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 11-Mar-2010 at 7:05pm
Removal probably isn't what you would want in any case, because plucking an Entity out of the cache when other things potentially have active references to it could cause many different kinds of disruption.

What might be desirable, on the other hand, would be to have the entities updated in place. That's exactly what we do when you retrieve copies of entities you already have in the cache (using EntityQueries, Refetch, navigation, or any other mechanism for data retrieval).  We make a number of different MergeStrategies available for doing this, but the default is that we will update the existing entity in the cache as long as it doesn't have unsaved changes.

We don't supply a setting on the EntityManager to do this automatically, but we do provide a number of mechanisms that permit you to accomplish what you want. In general it's good to be as specific as possible about what you really need refreshed, as it's not hard to impair performance if you're a bit too gratuitous in retrieving and re-retrieving data.

On platforms other than Silverlight, we have a push notification facility that allows you to invoke a method on the Business Object Server which then stays alive and does any operation you need, such as requerying the database at a specified interval, determining if any entities have changed, and then calling the client to let it know that they have. When we implemented push, the necessary infrastructure wasn't available in Silverlight. It now is, but we simply haven't gotten back around to push for that platform yet. It's on our list.

It's often not the best solution in any case. You (the developer) can generally figure out which entities go stale at what intervals, or in which parts of the application (and when the user does what) those entities need to be brought into currency. If you're writing on online ticket sales application, for example, you'd surely want to provide current data to the sales clerk about what seats remain unsold when she's talking with a customer. But you could give her a button to demand that when a customer inquires about a given event, for example.

So, lots of mechanisms. If you like, say more about your use case and perhaps we can suggest a specific strategy.
Back to Top
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 Posted: 12-Mar-2010 at 7:38am
Thanks for the reply. 
 
We are a SmartClient framework accessing a legacy ERP systems database.  Updates to the database can happen from many different sources outside of our SmartClient so we are needing the cache to periodically check to see if it has been updated.  So the Business Object Server requerying the database at a specific interval to determine if entities have changed is what we are looking for, are there any examples of this or a spot in the documentation that you can point me to to help me out.
 
Thanks,
Kurt
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 12-Mar-2010 at 10:03am
In the Business Object Persistence topic document, see the following sections:
  • Stale Entity Data
  • Query Workflow
  • Query Strategy
  • Fetch Strategies
  • Merge Strategies
In the Business Object Persistence - Advanced topic document, see:
  • Forced Re-Fetch
  • Merge Strategy in More Detail
 
There also is a Push Notification code sample, with accompany documentation, in the Learning Resources at
 
     LearningResources\050_BusObjServer\Samples\300WNF_ServerPushNotification
 
although, as I say, this facility is not currently available for Silverlight.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down