/// <summary> /// 给Session续期 /// </summary> public static bool Postpone(string sessionId) { bool b = RedisHash.SetExpire(sessionId, new TimeSpan(0, RedisManager.TimeOut, 0)); // HeShang365.Log.Logger.Info("续期", b.ToString() + "," + sessionId + DateTime.Now.ToShortDateString()); return(b); }
/// <summary> /// 存入到缓存中 /// </summary> /// <param name="key">要存入的键</param> /// <param name="value">要存入的键对应的值</param> private void SetSession(string key, object value) { if (string.IsNullOrWhiteSpace(key)) { throw new Exception("Key is Null or Epmty"); } string sessionField = preSession + key; //写入键值 bool b = RedisHash.SetEntryInHash(SessionId, sessionField, value.ToString()); // HeShang365.Log.Logger.Info("设置键值", b.ToString() + "," + key + "," + SessionId + ","+value+"," + DateTime.Now.ToShortDateString()); bool c = RedisHash.SetExpire(SessionId, new TimeSpan(0, RedisManager.TimeOut, 0));//设置有效期 // HeShang365.Log.Logger.Info("设置有效期", c.ToString() + "," + SessionId + DateTime.Now.ToShortDateString()); }