Question

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;
}
Was it helpful?

Solution

Can you create a custom class wrapper around the DateTime that would be mutable, say a UserStateInfo?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top