private static async Task UpdateSubjectRefreshTokensList(string token, RefreshTokenDescription desc, IRedisConnection c)
        {
            var skKey = SubjectRefreshTokensRedisKey.Create(desc.LoginRequest.Subject);
            var sk    = new RedisKey <SubjectRefreshTokenList>(skKey, c);
            var subjectRefreshTokenList = await sk.GetAsync();

            if (subjectRefreshTokenList != null)
            {
                var expiredRt = subjectRefreshTokenList
                                .Where(t => t.NotAfter < DateTime.Now)
                                .ToArray();
                foreach (var srt in expiredRt)
                {
                    subjectRefreshTokenList.Remove(srt);
                }
            }
            else
            {
                subjectRefreshTokenList = new SubjectRefreshTokenList();
            }

            subjectRefreshTokenList.Add(new SubjectRefreshToken
            {
                RefreshToken = token,
                NotAfter     = desc.NotAfter
            });

            await sk.SetAsync(subjectRefreshTokenList);
        }
        public async Task RemoveBySubject(string subject)
        {
            if (subject == null)
            {
                throw new ArgumentNullException(nameof(subject));
            }

            using (var c = await RedisManager.GetConnection())
            {
                var skKey = SubjectRefreshTokensRedisKey.Create(subject);
                var sk    = new RedisKey <SubjectRefreshTokenList>(skKey, c);
                var subjectRefreshTokenList = await sk.GetAsync();

                if (subjectRefreshTokenList != null)
                {
                    var keysToRemove = subjectRefreshTokenList
                                       .Select(itm => RefreshTokenRedisKey.Create(itm.RefreshToken));
                    await c.DeleteKeysAsync(keysToRemove);
                }

                await sk.DeleteAsync();
            }
        }