Ok so say every time a user hits my web service I add an item to the cache:
DateTime? token = HttpContext.Current.Get(TimeoutKey) as DateTime?;
int hashkey = (email + password).GetHashCode();
if (token == null)
{
HttpContext.Current.Cache.Add(
hashkey.ToString(),
DateTime.Now,
null,
Cache.NoAbsoluteExpiration,
new TimeSpan(0, 20, 0),
CacheItemPriority.NotRemoveable,
UserTimedOut);
}
else
{
// How to do this without triggering UserTimedOut?
Cache[hashkey.ToString()] = DateTime.Now;
}
Can you create a custom class wrapper around the DateTime
that would be mutable, say a UserStateInfo
?