Caching Application Block memory usage

Topics: Caching Application Block
Jan 3, 2008 at 9:10 PM
I'm in the process of evaluating the Caching Application Block. I want to make sure I understand the memory usage properly. I want to use the isolated storage backing store.

Is the in memory representation of the cached data only loaded when the CacheManager is first referenced (via CacheFactory.GetCacheManager)?
Is the in memory representation of the cached data cleaned up when the CacheManager instance is no longer referenced?

What I am thinking is I may want use some CacheManagers mainly for the backing store of data for offline behavior, but I do not want the overhead of always having that data loaded in memory. Am I misusing the application block for this purpose?

Thanks in advance.
Jan 3, 2008 at 11:25 PM
Hi,

Answers inline. Additionally, you may benefit from this previous thread http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=11938.

Fernando


Is the in memory representation of the cached data only loaded when the CacheManager is first referenced (via CacheFactory.GetCacheManager)?

Yes


Is the in memory representation of the cached data cleaned up when the CacheManager instance is no longer referenced?

No. The cache manager is a singleton, so it will remain referenced until the app domain is unloaded.


What I am thinking is I may want use some CacheManagers mainly for the backing store of data for offline behavior, but I do not want the overhead of always having that data loaded in memory. Am I misusing the application block for this purpose?

This is not really the usage the block was designed for. Depending on what you're storing, you might be able to use the cache manager in a separate app domain that you can unload as needed.