I am using
Microsoft.ApplicationServer.Caching.DataCache for caching
The problem is when I first add an item to the cache it preserves the time out but if I replace the existing item the cahce overrides the timeout to the default value. Here is the code I am using.
DataCache cache= new MyDataCahce();
// time out 30 secs
cache.Add("key",10, TimeSpan.FromMilliseconds(30000));
var temp = _cache.GetCacheItem("key");
temp.Timeout(); // minutes = 30 seconds which is correct
// Second time replace object at key
cache.Put("key",20)
var temp = _cache.GetCacheItem("key");
temp.Timeout(); // timeout reset to default and equals 10 minutes which is the default