예제 #1
0
        public async Task <IActionResult> Get()
        {
            _cacheKey = new DistributedCacheKey <DocumentTypeDTO>(-1);
            var cachedResult = await _cacheStore.GetDataListAsync(_cacheKey.CacheKey);

            if (cachedResult == null)
            {
                var collection = _repository.GetAll();
                var dto        = _mapper.Map <IEnumerable <DocumentTypeDTO> >(collection);
                await _cacheStore.AddDataListAsync(dto, _cacheKey.CacheKey);

                return(Ok(dto));
            }
            return(Ok(cachedResult));
        }