Ejemplo n.º 1
0
        public async Task <BookDetailsServiceModel> BookDetailsAsync(int bookId)
        {
            var bookDetailsCacheKey = nameof(Book) + "/" + bookId;

            return(await _cache.GetOrCreateAsync(bookDetailsCacheKey, async entry =>
            {
                entry.SlidingExpiration = DefaultCacheDuration;
                return await _booksService.BookDetailsAsync(bookId);
            }));
        }