We have an existing asp.net 4.0 site that uses HttpRuntime.Cache for many things. It was created this way before I started working on it, and now we have problems clearing the cache, and the site crashes because it always expects the cache to be there (I know ... what they thought the cache was !?).
So, I need a spare cache, which is permanent, so I can change it to HttpRuntime.Cache without affecting the site. I looked at serialization, but not all objects are serializable, and itβs not possible to make them all serializable (there are too many of them scattered all over).
Is there a way to save any object / memory variable / to disk and read it later without having to serialize it?
Update:
Thanks for your comments and answers. Starting with your ideas, I did a few more Googling and came across this article, which demonstrates (using an example solution that you can download) how to use your own custom caching provider in .NET 4.0. I was not able to integrate it into our web application and give it another test (I hope I can do it later), but I thought I put it here to find out if you have any thoughts on this. .. so do you think any warnings I should be aware of? Or is this a viable (and very temporary) solution?
File-based cache for web and non-web applications plus ASP.NET 4.0 extension OutputCacheProvider
source share