Copied to clipboard

Flag this post as spam?

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


  • Scott Blomfield 30 posts 57 karma points
    Nov 12, 2012 @ 22:51
    Scott Blomfield
    0

    Disable razor macro from being cached via code

    I have a razor cshtml macro that loads data from a third-party service. Because the service is rate limited, and also to improve performance, I have this macro set to cache for 300 seconds.

    Occasionally this service returns no data. When this happens, the macro renders and empty list (as designed), but the output is still cached.

    Is there a way for the razor code to notify umbraco that the generated output should not be cached? Or should I build my own caching mechanism for the third party service and mark the macro as non-cached?

  • Stephen 767 posts 2273 karma points c-trib
    Nov 14, 2012 @ 21:20
    Stephen
    0

    There's no way that I'm aware of that can let a macro indicate that it does not want to be cached, although that could be a nice addition. So I'd rather not cache the macro, and setup you own cache mechanism.

Please Sign in or register to post replies

Write your reply to:

Draft