Ejemplo n.º 1
0
 public static bool SetDataWithKey(string sessionName, object key, object data, int expirationMinute = 0)
 {
     if (expirationMinute > 0)
     {
         ExpirationSolution.Add(sessionName, expirationMinute);
     }
     return(OCBSession.TrySet(sessionName, new DataWidthKey(key, data)));
 }
Ejemplo n.º 2
0
 public static bool SetData(string sessionName, object ob, int expirationMinute = 0)
 {
     if (expirationMinute > 0)
     {
         ExpirationSolution.Add(sessionName, expirationMinute);
     }
     return(OCBSession.TrySet(sessionName, ob));
 }
Ejemplo n.º 3
0
        public static List <T> GetListData <T>(string entryName, bool removeEntry = false)
        {
            object ob;

            if (OCBSession.TryGet(entryName, out ob, removeEntry))
            {
                return((List <T>)ob);
            }
            return(null);
        }
Ejemplo n.º 4
0
        public static T GetData <T>(string entryName, bool removeEntry = false)
        {
            object ob;

            if (OCBSession.TryGet(entryName, out ob, removeEntry))
            {
                DataWidthKey ret = ob as DataWidthKey;
                if (ret != null)
                {
                    return((T)ret.Data);
                }
                else
                {
                    return((T)ob);
                }
            }
            return(default(T));
        }
Ejemplo n.º 5
0
        public static T GetDataWithKey <T>(string sessionName, object key, bool removeIfKeyNotMatch = true, bool removeSession = false)
        {
            object ob = null;

            if (OCBSession.TryGet(sessionName, out ob, removeSession))
            {
                DataWidthKey dw = ob as DataWidthKey;
                if (dw != null)
                {
                    if (dw.Key.Equals(key))
                    {
                        return((T)dw.Data);
                    }
                    else if (!removeSession && removeIfKeyNotMatch)
                    {
                        OCBSession.Remove(sessionName);
                    }
                }
            }
            return(default(T));
        }
Ejemplo n.º 6
0
 public static bool RemoveAllData()
 {
     return(OCBSession.RemoveAll());
 }
Ejemplo n.º 7
0
 public static bool RemoveData(string sessionName)
 {
     return(OCBSession.Remove(sessionName));
 }