Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 873 posts 2086 karma points
    Jan 31, 2014 @ 12:52
    Matt Taylor
    1

    Donut caching - Profiles

    This donut caching seems pretty cool so I've been looking into it a bit.

    I did wonder how much use it would be with Umbraco where the content XML is already cached but it does make a difference. I suppose you just have to consider if you can afford the extra memory.

    I wanted to share something I found, Using a cache profile.

    Rather than decortaing all your controller actions with the same caching options you can simply add the following within the system.web section of the web.config:

    <caching>
          <outputCacheSettings>
            <outputCacheProfiles>
              <add name="OneDay" duration="86400" location="Server" varyByCustom="url;device" />
            </outputCacheProfiles>
          </outputCacheSettings>
    </caching>

    The declaration on the controller action then becomes:

    [DonutOutputCache(CacheProfile="OneDay")]

    The advantage is you don't have to search all your code to make a change and a any modifications are quickly made in the web.config so no recompilation and assebly deployment.

    Matt

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 31, 2014 @ 20:37
    Jeroen Breuer
    102

    Hello,

    Thanks for the idea. For the next version I might use your suggestion.

    Umbraco with MVC can be very fast, but I also notice that using DonutOutputCache still makes a difference. Websites that load in 300ms server side are only 60ms after using the DonutOutputCache attribute.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Feb 03, 2014 @ 16:06
    Jeroen Breuer
    0

    Another big benefit is that if you set the duration in the web.config to 0 you can disable donut cache during development and you don't need to comment the attribute everywhere.

    Jeroen

  • Matt Taylor 873 posts 2086 karma points
    Feb 03, 2014 @ 16:11
    Matt Taylor
    1

    That's right. :-)

Please Sign in or register to post replies

Write your reply to:

Draft