You can use the built-in functionality of the DNN cache.
using DotNetNuke.Common.Utilities;
public bool cacheExists(string key)
{
return DataCache.GetCache(key) != null;
}
public void setCache<T>(T value, string key)
{
DataCache.SetCache(key, value);
}
public T getCache<T>(string key)
{
return (T)DataCache.GetCache(key);
}
Using:
string myString = "test";
Book myBook = new Book();
setCache(myString, "A");
setCache(myBook, "B");
string myStringFromCache = getCache<string>("A");
Book myBookFromCache = getCache<Book>("B");
Vddwd source
share