public void UpdateUserCache(IEnumerable <Guid> userIds)
        {
            var allUsers     = GetAllFromSql();
            var updatedUsers = allUsers.Join(userIds, u => u.Id, id => id, (u, id) => u).ToList();

            var allCachedUsers = GetAll().ToList();
            var oldCachedUser  = allCachedUsers.Join(userIds, u => u.Id, id => id, (u, id) => u).ToList();

            oldCachedUser.ForEach(ocu =>
            {
                if (ocu != null)
                {
                    allCachedUsers.Remove(ocu);
                }
            });

            updatedUsers.ForEach(u =>
            {
                if (u != null)
                {
                    allCachedUsers.Add(u);
                }
            });

            _cacheService.Set(UsersCacheKey, allCachedUsers, CacheHelper.GetMidnightUtcDateTimeOffset());
        }
        public virtual void DeleteFromCache(Guid userId)
        {
            var allCachedUsers = GetAll().ToList();
            var oldCachedUser  = allCachedUsers.Find(el => el.Id == userId);

            if (oldCachedUser != null)
            {
                allCachedUsers.Remove(oldCachedUser);
            }
            _cacheService.Set(UsersCacheKey, allCachedUsers, CacheHelper.GetMidnightUtcDateTimeOffset());
        }
        public virtual IEnumerable <T> GetAll()
        {
            var users = _cacheService.GetOrSet(UsersCacheKey, GetAllFromSql, CacheHelper.GetMidnightUtcDateTimeOffset()).ToList();

            return(users);
        }
        public virtual IEnumerable <T> GetAll()
        {
            var members = _cacheService.GetOrSet(MembersCacheKey, () => GetAllFromSql().ToList(), CacheHelper.GetMidnightUtcDateTimeOffset()).ToList();

            return(members);
        }