Пример #1
0
        public async Task <IEnumerable <RoleTypeModel> > GetAllRoleTypes(int divisionId)
        {
            const string cacheKey = "role-types";

            var cachedResponse = await _redisCacheService.GetCachedData <IEnumerable <RoleTypeModel> >(cacheKey);

            if (cachedResponse != null)
            {
                return(cachedResponse);
            }

            var roleTypes = (await _misService.GetAllRoleTypes(divisionId)).ToList();

            await _redisCacheService.SetCacheData(cacheKey, roleTypes, TimeSpan.FromSeconds(86400));

            return(roleTypes.OrderBy(x => x.RoleTypeName));
        }