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

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

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