our project uses HttpRuntime.Cache.Get and HttpRuntime.Cache.Insert for storing and retrieving data from the cache.
Is it possible to store this cache in a SQL server database?
By data I am referring to all sorts of different object types.
our project uses HttpRuntime.Cache.Get and HttpRuntime.Cache.Insert for storing and retrieving data from the cache.
Is it possible to store this cache in a SQL server database?
By data I am referring to all sorts of different object types.
The HttpRuntime Cache is bound to the appdomain of the current application and you can control how it is stored. It does smart management on the cache, like clearing objects before there lifespan in the cache is over when you are low on memory. The main point of having the cache in memory is realy fast access to your cached objects. You have no control in where or how the data is stored.
If you have some reason to store the data out of your process, you have the possiblity to implement your own caching.
public class DatasetStore : MarshalByRefObject
{
// A hash table-based data store
private Hashtable htStore = new Hashtable();
//Returns a null lifetime manager so that GC won't collect the object
public override object InitializeLifetimeService() { return null; }
// Your custom cache interface
}
For example you can share this cache between multiple appdomains.