Copied to clipboard

Flag this post as spam?

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


  • Jonathan Lathigee 56 posts 99 karma points
    Jun 09, 2010 @ 19:18
    Jonathan Lathigee
    0

    How does macro caching work?

    Curious about setting caching settings on macros ("cache period", "cache by page", "cache personalized"). Specifically, I am using Twitter for Umbraco and find that, occasionally, the feed drops out and doesn't display. Presumably this is because of some timeout between the page and the Twitter servers.

    First of all: Enabling caching for that macro (set to 300 seconds), will (I'm assuming) reduce the number of calls made to the Twitter servers, as it will only need to go out at most every 300 seconds. Right?

    Second: Is there any sort of fallback? ie makes successful call, populates feed, people come to site for next 300 seconds, site serves up cached data, 300 seconds ellapses, new call made to twitter, let's say twitter call *FAILS* at this point, what happens? No feed? Fallback on cached data?

    Any assistance appreciated

    Jonathan

  • Bert 128 posts 251 karma points
    Jun 09, 2010 @ 20:25
    Bert
    0

    "cache period" : the time the cache last before being refreshed

    "cache by page": cache is per page based. So if person A visits the page the chache gets loaded, person B visits the page 1 second later he will see the same cache

    "cache personalized": cache per visitor. So if person A visits the page the chache gets loaded, person B visits the page 1 second later cache will be loaded for him as well (might be different from person A. However if they return within the cache period they won't reload the cache and see the previous cache (person A --> cache A, person B --> cache B)

     

    The caching mechanism doesn't has a fallback mechanism in place.

  • ben_a 65 posts 123 karma points
    Jun 09, 2010 @ 20:39
    ben_a
    0

    I highly recommend using the feedcache plug-in for Umbraco. I use it for all sorts of things like weather, etc. It DOES have failback mechanisms, so your macros will fail gracefully. Essentially, if the feed is not available, it will leave the current XML file in place, so the worst that happens is that your feed gets old.

    To use the data you just form an xpath query like this: <xsl:for-each select="umbraco.library:GetXmlDocument(*pathtoXMLfile*/rss/channel/item">

    Once you have your feeds configured, just set a schedule task to fire the feedcache plug-in at whatever interval you like.

  • ben_a 65 posts 123 karma points
    Jun 09, 2010 @ 20:41
    ben_a
    0

    Sorry, bad syntax in xpath above. A better example is:

    <xsl:for-each select="umbraco.library:GetXmlDocument($feedSource, 1)/rss/channel/item">

    where $feedsource is the path to the xml file outputted by the feedcache plug in. In my case:

    /umbraco/plugins/FergusonMoriyama/feedcache/news.xml

  • Owen Blacker 19 posts 92 karma points
    Jan 12, 2013 @ 15:57
    Owen Blacker
    0

    I don't quite understand what the caching is doing. We have a Razor macro (in an Umbraco 4.7.2 site) rendering our sitewide navigation. It doesn't highlight the current page, so it should not vary between pages. If I tell the macro to be cached (so with a Cache Period greater than zero), if fails to render.

Please Sign in or register to post replies

Write your reply to:

Draft