public static List <ConversationRoom> GetRooms() { using (var redisClient = RedisManager.GetClient()) { return(redisClient.Get <List <ConversationRoom> >(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom))); } }
public static List <SignalRUser> GetUsers() { using (var redisClient = RedisManager.GetClient()) { return(redisClient.Get <List <SignalRUser> >(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser))); } }
public static void Init() { using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), new List <SignalRUser>()); redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), new List <ConversationRoom>()); } }
public static void RemoveRoom(ConversationRoom room) { var Rooms = GetRooms(); Rooms.Remove(Rooms.First(c => c.RoomName == room.RoomName)); using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), Rooms); } }
public static void AddRoom(ConversationRoom room) { var Rooms = GetRooms(); Rooms.Add(room); using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRRoom), Rooms); } }
public static void RemoveUser(SignalRUser user) { var Users = GetUsers(); Users.Remove(Users.First(c => c.UserCode == user.UserCode)); using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), Users); } }
public static void SetUser(SignalRUser user) { var Users = GetUsers(); Users[Users.FindIndex(c => c.UserCode == user.UserCode)] = user; using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), Users); } }
public static void AddUser(SignalRUser user) { var _users = GetUsers(); _users.Add(user); using (var redisClient = RedisManager.GetClient()) { redisClient.Set(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SignalRUser), _users); } }
protected void Application_Start() { var config = new HubConfiguration(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); using (var redisClient = RedisManager.GetClient()) { //设置超级管理员 redisClient.Set <string>(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.SuperAdminUserCode), "58657C04BCADF3C6AA26F2B79D24994D"); redisClient.Set <string>(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.CSSAndJSVersion), SystemConfigBll.Instance.GetValueByKey(RedisCategoryKeyEnum.CSSAndJSVersion.ToString())); } }
public override void OnAuthorization(AuthorizationContext filterContext) { filterContext.Controller.TempData["cssAndJSVersion"] = "?v=" + SystemConfigBll.Instance.GetValueByCache(RedisKey.GetKey(RedisAppKeyEnum.Alpha, RedisCategoryKeyEnum.CSSAndJSVersion)); }