Esempio n. 1
0
        public IViewComponentResult Invoke(string movieName)
        {
            IExpirationTrigger trigger;
            var quote = _moviesService.GetCriticsQuote(out trigger);

            // This is invoked as part of a nested cache tag helper.
            EntryLinkHelpers.ContextLink.AddExpirationTriggers(new[] { trigger });

            return(Content(quote));
        }
Esempio n. 2
0
        public IViewComponentResult Invoke(string movieName)
        {
            string quote;

            if (!_cache.TryGetValue(movieName, out quote))
            {
                IExpirationTrigger trigger;
                quote = _moviesService.GetCriticsQuote(out trigger);
                _cache.Set(movieName, quote, new MemoryCacheEntryOptions().AddExpirationTrigger(trigger));
            }

            return(Content(quote));
        }
Esempio n. 3
0
 public IViewComponentResult Invoke(string movieName)
 {
     return(Content(_moviesService.GetCriticsQuote(movieName)));
 }