示例#1
0
        public override void Set(string name, object value)
        {
            var sessionObj = getSession();

            if (sessionObj == null)
            {
                sessionObj = new SessionObj();
            }
            if (sessionObj.Data == null)
            {
                sessionObj.Data = new Dictionary <string, string>();
            }
            sessionObj.Data[name] = SerializeHelper.SerializerToJson(value);
            client.KSet(SessionId, sessionObj, new TimeSpan(0, timeOut, 0));
        }
示例#2
0
        public void SaveSession(string user, ApiSessionData data)
        {
            data.ExpTime = DateTime.Now.AddMinutes(20);
            var client = new RedisClient(3);

            client.KSet(user, data, TimeSpan.FromMinutes(20));
        }