Fragment caching with Radiant CMS
June 10th, 2008 By: Wes BangerterWe’re in the process of converting our website to Radiant CMS, and one of the new things on the site is a “Blog Blurbs” section at the bottom of every page that lists our latest blog post. Our blog is in Wordpress, so I setup the RSS Reader extension in Radiant to fetch the posts. Everything worked great, except that page loading was noticeably slower. After the page gets cached everything is fine but this is included on every page so going through the site when there were not cached pages was really frustrating. I thought about modifying the RSS Reader extension to cache our blog blurbs, but I figured a more general approach would work better, so I came up with a fragment caching extension. We’re using it like this:
<r:cache name="rss_fragment" time="60">
<r:feed:items url="[feed_url]" limit="1">
<h3><r:feed:link /></h3>
<p><r:feed:content max_length="300" no_html="true" /></p>
</r:feed:items>
</r:cache>The code is at github.

The Sevier River Water Users Association (SRWUA) in Central Utah are pioneers in the use of the Real-Time Web. For the past 10 years SRWUA has been delivering real-time water flow data to the public via the website www.SevierRiver.org.
More that 100 remote, solar-powered, stations record wate...