I have several asp.net websites on a production server that suddenly have caching issues. The problem is that my cache values are not saved when using the Cache.Insert method. Using Cache ["key"] = value still works.
For example, when I set a value like this, it is null when I retrieve it.
HttpRuntime.Cache.Insert("CacheTestVal", "Help Me!" null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration);
When I set a value like this, I can get the expected value
Cache["CacheTestVal"] = "Help Me!";
I need to set an absolute expiration for the cache value, so I cannot use the Cache [""] method. All help is appreciated. Thank.
Edit: I found that setting absolute expiration as a UTC datetime works . I believe the problem is that the server does not convert absolute expiration to UTC when using DateTime.Now.
HttpRuntime.Cache.Insert("CacheTestVal", "Help Me!" null, DateTime.UtcNow.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration);
The date / time and time zone are set as I would expect on the server, but maybe IIS does not recognize this, or is there a bad configuration value somewhere?
IUJPJ source
share