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))); }
public static bool SetData(string sessionName, object ob, int expirationMinute = 0) { if (expirationMinute > 0) { ExpirationSolution.Add(sessionName, expirationMinute); } return(OCBSession.TrySet(sessionName, ob)); }
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); }
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)); }
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)); }
public static bool RemoveAllData() { return(OCBSession.RemoveAll()); }
public static bool RemoveData(string sessionName) { return(OCBSession.Remove(sessionName)); }