Beispiel #1
0
 public void Write(string key, string value, DateTime expiration)
 {
     FixedSessionCache.CacheValue cacheValue = new FixedSessionCache.CacheValue()
     {
         Value     = value,
         ExpiresOn = DateTime.UtcNow.AddMinutes(10)
     };
     HttpContext.Current.Session["_O365#" + key] = (object)cacheValue;
 }
Beispiel #2
0
 public string Read(string key, out DateTime expiration)
 {
     FixedSessionCache.CacheValue cacheValue = HttpContext.Current.Session["_O365#" + key] as FixedSessionCache.CacheValue;
     if (cacheValue == null)
     {
         expiration = DateTime.UtcNow.AddMinutes(-10);
         return((string)null);
     }
     else
     {
         expiration = cacheValue.ExpiresOn;
         return(cacheValue.Value);
     }
 }