//最终用于清除的方法,过期与主动都调用其 public static void ClearByKeys(string keys) { keys = keys.TrimEnd(','); if (!string.IsNullOrEmpty(keys)) { try { foreach (string key in keys.Split(',')) { //后期改为缓存事件分发 M_Cache model = UserSession[key]; B_User.UpdateField("LastActiveTime", (DateTime.Now.AddMinutes(-ActiveSpan)).ToString(), model.UserID, false); UserSession.Remove(key); } } catch (Exception ex) { ZLLog.L(Model.ZLEnum.Log.labelex, "用户缓存出错:" + ex.Message); } } }