Ejemplo n.º 1
0
        public void UpdateExpire(string sid)
        {
            string sidKey = $"{preSidKey}{sid}";

            if (RedisStoreHelper.KeyExists(sidKey))
            {
                string userKey = RedisStoreHelper.GetString(sidKey);
                RedisStoreHelper.KeyExpire(userKey, TimeSpan.FromMinutes(keyExpire));
                RedisStoreHelper.KeyExpire(sidKey, TimeSpan.FromMinutes(keyExpire));
            }
        }
Ejemplo n.º 2
0
        public void SetUserCached(string sid, UserInfo userInfo, List <UserRoleRelation> userRole)
        {
            string sidKey  = $"{preSidKey}{sid}";
            string userKey = $"{preUserKey}{userInfo.Id}";

            RedisStoreHelper.HashSetString(userKey, "Sid", sid);
            RedisStoreHelper.HashSetValue <UserInfo>(userKey, "UserInfo", userInfo);
            RedisStoreHelper.HashSetValue <List <UserRoleRelation> >(userKey, "UserRole", userRole);
            RedisStoreHelper.KeyExpire(userKey, TimeSpan.FromMinutes(keyExpire));

            RedisStoreHelper.SetString(sidKey, userKey, TimeSpan.FromMinutes(keyExpire));
        }