Cache is really meant for just that -- caching. With the caching model, if something isnt available, you do whatever you need to do to retrieve it, otherwise you use the cached copy. That doesnt appear to be the pattern you need here because you don't want
the cache to ever be invalidated.
So instead you can use static members (but be careful to ensure thread safety and without sacraficing performance), or use the Application object, which is like Cache but doesn't offer the invalidation and timeout features.
InfinitiesLo...
Participant
1972 Points
322 Posts
Microsoft
Re: Losing cached objects very randomly
Sep 08, 2006 07:50 PM|LINK
Cache is really meant for just that -- caching. With the caching model, if something isnt available, you do whatever you need to do to retrieve it, otherwise you use the cached copy. That doesnt appear to be the pattern you need here because you don't want the cache to ever be invalidated.
So instead you can use static members (but be careful to ensure thread safety and without sacraficing performance), or use the Application object, which is like Cache but doesn't offer the invalidation and timeout features.
I hope that helps
Infinities Loop: TRULY Understanding ViewState
.NET from a new perspective.
This posting is provided "AS IS".