I have a thread running behind my ASP.Net. In this thread I put data in the cache like this:
HttpRuntime.Cache.Insert("test", "test", null, DateTime.Today.AddHours(6), Cache.NoSlidingExpiration);
On the other thread(the webpage) I first check if the cache contains any data, and then try to get the object from the cache, like this:
if (HttpRuntime.Cache.Count > 0) {
var test = (string)HttpRuntime.Cache["test"];
}
Edit: Everytime when I'm trying to do var test = (string)HttpRuntime.Cache["test"];
the cache will go empty(or will delete the object, haven't tested multiple objects in cache) plus the var test
is also null. This is ofcourse when HttpRuntime.Cache.Count is bigger than 0
Oh and it gives no exceptions or anything