/// <summary> /// API用户过期信息缓存 /// </summary> public void SetUserCacheAPI(Sys_User user) { //生成用户token var token = Sys_User.GetKey(user.UserId); CacheManager.Add(token, user, 12 * 60); }
public bool CheckToken(string userId) { string userkey = Sys_User.GetKey(userId); var user = CacheManager.GetData <Sys_User>(userkey); return(user != null); }
/// <summary> /// 需要放入缓存的用户信息 /// </summary> public void SetUserCache(Sys_User user) { //用户信息添加缓存 string userId = user.UserId; CacheManager.Add(Sys_User.GetKey(userId), user); //用户菜单信息 var userMenus = navMenuBll.GetNavMenuByUserId(userId); //查询站内未读消息条数,并加入缓存 }
public ActionResult Action(string loginId, string backUrl = "") { var key = Sys_User.GetKey(loginId); var userInfo = CacheManager.GetData <Sys_User>(key) ?? new Sys_User(); var userMenus = _navMenuBll.GetNavMenuByUserId(loginId.ToString()); ViewData["userInfo"] = userInfo; ViewData["userMenus"] = userMenus; ViewBag.backUrl = string.IsNullOrWhiteSpace(backUrl) ? UrlString.ExhibitionViewUrl : backUrl; return(View()); }