Print Page | Close Window

Clear the cache - when?

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=225
Printed Date: 31-Mar-2025 at 2:28pm


Topic: Clear the cache - when?
Posted By: Customer
Subject: Clear the cache - when?
Date Posted: 12-Jul-2007 at 4:29pm

I would like to ask you something about clearing the cache of the PersistenceManager. 

In our application, we are using only one PersistenceManager but we want to identify a good moment in time when we should clear its cache.

The database used by our application is updated also by a different application (developed without IdeaBlade) and that’s why we need to be really sensitive to the changes appeared on our objects after they are loaded in the cache.

Could you help us to design a good approach for this problem?




Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 4:30pm
You have to be very careful about clearing the cache of the PersistenceManager.  If you don’t do it correctly, you can easily encounter mysterious crashes.

 

The important thing to know is what pieces of software hold references to the entities in the cache.  For example, in our UI software, most BindingSources are composed of EntityLists which hold references to entities in the cache.  If you clear the cache, the BindingManager or the Grid will try to traverse the EntityList and will crash due to a null reference.  You can run into similar problems with Event Handlers and Property Descriptors.  The same thing will happen if you use some other vendor’s UI software.  This software will initially be able to reference the objects in the cache, but before you can clear the cache, you need to be sure that there are no longer any references to the objects in the cache.




Print Page | Close Window