Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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
"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.
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.
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:
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.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted