Copied to clipboard

Flag this post as spam?

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


  • Thomas Dolberg 74 posts 95 karma points
    Dec 11, 2011 @ 20:31
    Thomas Dolberg
    0

    Macrocache expires on publish

    I use macrocaching quite a lot and for some of them I have set quite a long expirytime on the frontpage of my site, because I don't need to refresh the contents often. It seems that all macro caching is removed (also the ones with long expirytime on the frontpage) when a node is published. Is this correct ? and if so how do I prevent the macros being refreshed on publish? I would prefer the macros to expire when the expirytime is reached and instead refresh the macros manually if I need to update the contents before the expiry time is reached.

     

    thanks

    Thomas

  • Rodion Novoselov 694 posts 859 karma points
    Dec 11, 2011 @ 22:44
    Rodion Novoselov
    0

    I'm not aware exactly how it works in details, but as for me this behaviour seems to be absolutely correct. In general caching means that you get content from a slow storage and put it to a fast storage so that reuse it without going anytime to the slow one. As the slow storage gets updated you want to have a fresh version of content in the fast storage.

    I don't know how to turn off the behaviour your mentioned, but probably something like a warm-up process after publishing could be of help. I.e. requesting pages by some robot to get the cache filled up again as soon as possible.

  • Thomas Dolberg 74 posts 95 karma points
    Dec 11, 2011 @ 22:47
    Thomas Dolberg
    0

    I sort of agree :-)

    In my case it expires macros which does not have anything to do with the published page. I totally agree that expiring macros which relate to the published page makes sense.

    /Thomas

  • Rodion Novoselov 694 posts 859 karma points
    Dec 11, 2011 @ 23:05
    Rodion Novoselov
    0

    BTW, I've just quickly skimmed over the code and I haven't managed to find at once the place pointing to clearing the macro cache on publishing.

    At least you could try one of the following:

    1. Publishing on the timer (i.e. set "publish at" time)
    2. Publishing programatically by the Document.Publish method

     

  • Thomas Dolberg 74 posts 95 karma points
    Dec 20, 2011 @ 18:24
    Thomas Dolberg
    0

    Hi Rodion

    In umbraco.presentation.macro.cs line 510 a macro is cached with the key "macroHtml_" and if I look at the umbraco source in umbraco.presentation.content.cs, line 146 it says:

         Cache.ClearCacheByKeySearch("macroHtml_");

     

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Dec 21, 2011 @ 12:30
    Tim
    0

    @Thomas, I think it'd be quite hard to expire only macro's relating to the published pages. For example, a page might be referred to in a user control macro, and the CMS has no way of looking in the user control to see if a page is being referenced by it. You could maybe do it with the XSLT ones, but it'd still be quite hard (and relatively slow) to parse through them all checking for references. Bear in mind that there are also multiple ways of referring to a page, e.g. by ID, by DocType, as a descentdent/ancestor in an XSLT select, all of which would have to be checked for!

    :)

  • Thomas Dolberg 74 posts 95 karma points
    Dec 23, 2011 @ 00:48
    Thomas Dolberg
    0

    @Tim, thanks. It kinda makes sense :-)

     

    I am trying to use standard .net outputcaching on my user controls. Do you know how I can vary the caching by page? 

     

    thanks

    Thomas 

Please Sign in or register to post replies

Write your reply to:

Draft