Example #1
0
 public static void Set(SessionKeys key, object obj)
 {
     if (key.IsInCache)
     {
         CacheSet(key, obj);
     }
     else
     {
         SESSION.Add(key.Value, obj);
     }
 }
Example #2
0
        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
                       ));
        }
Example #3
0
 public static void Delete(SessionKeys key)
 {
     if (key.IsInCache)
     {
         CACHE.Remove(key.Value);
     }
     else
     {
         SESSION.Remove(key.Value);
     }
 }
Example #4
0
        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]);
        }
Example #5
0
        public static T GetValue <T>(SessionKeys key)
        {
            object obj = Get(key);

            return((T)obj);
        }
Example #6
0
        public static string GetValue(SessionKeys key)
        {
            object obj = Get(key);

            return((obj + string.Empty).ToString());
        }
Example #7
0
 private static object CacheGet(SessionKeys key)
 {
     return(CACHE.Get(key.Value));
 }
Example #8
0
 public static bool Contains(SessionKeys key)
 {
     return(Get(key) != null);
 }