Some more thoughts…

You could also track the time at which you got it, and then on the page where 
it’s shown, you could add a flag of some sort if the date is older than the 2 
minutes, if knowing that may be important to your users.

Another thing is that rather than rely on CFcache to cache things, you can be 
more explicit (and help better manage the cache) by using CF9+’s new caching 
functions. So you could check the time, decide whether to retrieve from the 
cache or not, and if so then store it anew in the cache. There are then other 
caching functions that would let you look at what was cached, to manage things 
(which may help you address the concerns Troy had). Those can be used whether 
the cache was written to via cfcache or the newer caching functions.

Finally, whether you go with either the idea to store the result in a file 
(Troy’s idea) or a variable or table (Cam’s idea) or the cache, there’s still 
something else you may want to consider, Chris, if you’re not familiar with it. 
You could either store the RSS feed or go ahead and write the formatted HTML 
into wherever you’d be persisting things, using CFSAVECONTENT. Just would allow 
you then to refer to that result quickly in your page where you’d “show” it 
finally. Some may debate if that’s confusing our “view” and your “model”. I’ll 
leave others to debate that if they want.  Just wanted you to know it was an 
option if it may help.

/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Cameron Childress
Sent: Monday, September 29, 2014 10:27 AM
To: discussion@acfug.org; Chris
Subject: Re: [ACFUG Discuss] Using caching and threading to load a page quickly

 

I'd load the RSS feed via a scheduled task and save it someplace like the 
application scope or a database table. Don't make your homepage do any of that 
work. 

 

-Cameron

 

 

Reply via email to