Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Greg Fyans 140 posts 342 karma points
    Feb 22, 2016 @ 09:50
    Greg Fyans
    0

    UmbracoApplication.GetVaryByCustomString not firing

    I'm trying to get Donut Caching working per page for some controls. I'm overriding the following method in the UmbracoApplication class:

    public class ApplicationStartup : UmbracoApplication
        {
            public override string GetVaryByCustomString(HttpContext context, string custom)
            {
                switch (custom)
                {
                    case "url":
                        return "url=" + context.Request.Url.AbsoluteUri;
                }
    
                return base.GetVaryByCustomString(context, custom);
            }
        }
    

    On my action method I have the following:

    [DonutOutputCache(CacheProfile = "CarouselItems", VaryByCustom = "url", VaryByParam = "*")]
            [ChildActionOnly]
            public ActionResult GetCarouselItems()
            {
                CarouselHelper helper = new CarouselHelper();
                HeaderCarouselViewModel headerCarouselViewModel = helper.GetCarouselItems(this.CurrentPage);
    
                return PartialView("Components/_Carousel", headerCarouselViewModel);
            }
    

    And finally I have the following cache profile:

    <caching>
          <outputCacheSettings>
            <outputCacheProfiles>
              <add name="CarouselItems" duration="10" varyByCustom="url" varyByParam="*" />
            </outputCacheProfiles>
          </outputCacheSettings>
        </caching>
    

    But, it never hits my GetVaryByCustomString method. Has anyone managed to get Donut Caching working on 7.4.1?

    Greg.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2016 @ 10:59
  • Greg Fyans 140 posts 342 karma points
    Feb 22, 2016 @ 11:10
    Greg Fyans
    0

    Doh, of course. It's definitely Monday :D

Please Sign in or register to post replies

Write your reply to:

Draft