• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

<cffeed> caching works locally but not on server

Contributor ,
Jan 25, 2013 Jan 25, 2013

Copy link to clipboard

Copied

So I got my new Hostek account set up (woohoo!) and I've started uploading some basic files so I can do thinks like validate my code and make sure everything's working.  One thing that does not work (but does locally) is my news feed caching.

Pulling in two RSS feeds was seriously slowing down my index page loading, so I stole a trick from Ray Camden on caching the feeds.  It works perfectly on my dev machine at home, but doesn't work on my hosted account.

Here's the exact code being used:

<cfset feedurl = "http://velonews.competitor.com/feed">

<cfset cacheTime = #createtimespan(1,0,0,0)#>

<cfif not structKeyExists(application,"rsscache") or dateDiff("n", application.rsscache.created, now()) gt cacheTime>

    <cffeed source="#feedurl#" query="entries">

    <cfset application.rsscache = structNew()>

    <cfset application.rsscache.data = entries>

    <cfset application.rsscache.created = now()>

</cfif>

<ul>

<cfloop query="#application.rsscache.data#" startrow="1" endrow="6">

<cfoutput><li><a href="#rsslink#">#title#</a></li></cfoutput>

</cfloop>

</ul>

I tried wrapping a try/catch around the top section (above the <ul>) and still got nothing for an error message.  The page just stops being rendered at that first <ul>.

I'm not sure why it works locally but not on the web server.  Any ideas?

Views

730

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 25, 2013 Jan 25, 2013

Copy link to clipboard

Copied

LATEST

Miraculously, I got it working.

I changed this:

<cfloop query="#application.rsscache.data#" startrow="1" endrow="6">

<cfoutput><li><a href="#rsslink#">#title#</a></li></cfoutput>

</cfloop>

To this:

<cfoutput maxrows="6" query="application.rsscache.data">

<li><a href="#rsslink#">#title#</a></li>

</cfoutput>

And bingo!  It worked. Perhaps it's an idiosyncrasy between CF9 and CF10.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation