public static void Set(SessionKeys key, object obj) { if (key.IsInCache) { CacheSet(key, obj); } else { SESSION.Add(key.Value, obj); } }
public static object CacheSet(SessionKeys key, object obj) { int defaultTime = 15; return(CACHE.Add( key.Value, obj, null, DateTime.Now.AddMinutes(defaultTime), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Normal, null )); }
public static void Delete(SessionKeys key) { if (key.IsInCache) { CACHE.Remove(key.Value); } else { SESSION.Remove(key.Value); } }
public static object Get(SessionKeys key) { if (SESSION == null) { return(null); } if (key.IsInCache) { object obj = CacheGet(key); if (obj == null && key.LoadFromDBhandler != null) { key.LoadFromDBhandler(); obj = CacheGet(key); } return(obj); } return(SESSION[key.Value]); }
public static T GetValue <T>(SessionKeys key) { object obj = Get(key); return((T)obj); }
public static string GetValue(SessionKeys key) { object obj = Get(key); return((obj + string.Empty).ToString()); }
private static object CacheGet(SessionKeys key) { return(CACHE.Get(key.Value)); }
public static bool Contains(SessionKeys key) { return(Get(key) != null); }