Copied to clipboard

Flag this post as spam?

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


  • Connie DeCinko 931 posts 1160 karma points
    Jun 22, 2012 @ 23:03
    Connie DeCinko
    0

    How to automatically/programatically expire macro cache?

    I have a section of my site where all the content nodes are basically banner ads. I have an XSLT macro that selects the top 4 and renders them on a couple pages. I want to cache this content as it only changes a few times per month. Problem is, as soon as I change the content, add a new node, unpublish a node, etc. I need the cache to be flushed/expired so the macro now shows the latest content with changes.

    So far, publishing the page the macro is on is hit or miss. The only thing that works is setting the cache to zero and then back to the amount of time I desire. Is there a way that I can automatically expire the cache when any content changes within this content node?

     

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jun 23, 2012 @ 04:40
    Tom Fulton
    0

    Hi Connie,

    I'm not too familiar with how the caching works, but I would think publishing the page with the macro is supposed to expire the cache.

    But anyway, since I can't realy help with that - how about checking out the Macro Cache Disabler package, you might be able to see what methods they are using to clear the cache and maybe you can do something similar with an AppBase event or the like.

    HTH,
    Tom 

  • Connie DeCinko 931 posts 1160 karma points
    Jun 27, 2012 @ 19:00
    Connie DeCinko
    0

    Thanks for the info Tom.

    Anyone else have any thoughts?

     

  • Sean Mooney 131 posts 158 karma points c-trib
    Jun 27, 2012 @ 23:22
    Sean Mooney
    0

    You could tie into the Publish event (http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples) and use the following code:

     

    umbraco.macro.GetMacro(10).removeFromCache()

     

     

Please Sign in or register to post replies

Write your reply to:

Draft