Beispiel #1
0
        /// <summary>
        /// Gets the story.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns></returns>
        public Story GetStory(int id)
        {
            if (MemoryCacheProvider.GetValue(id.ToString()) is Story story)
            {
                return(story);
            }

            story = _reader.GetStory(id);
            int cacheStoriesInDays = Convert.ToInt32(_configuration["CacheStoriesInDays"]);

            MemoryCacheProvider.Add(id.ToString(), story, DateTime.Now.AddDays(cacheStoriesInDays));
            return(story);
        }