Forum: Ruby on Rails simple-rss caching

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A68e38809ace8356ec2fa6aa1d13246b?d=identicon&s=25 Vince W. (vince)
on 2006-06-14 16:01
The index page of my rails app grabs an rss feed from a neighboring news
site.  Unfortunately, the process of grabbing that feed seems to be
slowing down the initial load time of my site to the point where it
takes about 10-12 seconds to respond and render.

I'd like to speed that up somehow (for 8-10 seconds it looks like my
server is not responding at all..)  Any suggestions?

I found this:
http://blog.codahale.com/2006/04/10/content-only-c...

But as soon as I modified my controller from < Application to <
ActionController::Base it stop rendering my page (which I guess is
expected but I have no idea how to workaround that.)

can somebody please help me with this?
Chris T (Guest)
on 2006-06-14 21:06
(Received via mailing list)
Vince W. wrote:
>
> But as soon as I modified my controller from < Application to <
> ActionController::Base it stop rendering my page (which I guess is
> expected but I have no idea how to workaround that.)
>
> can somebody please help me with this?
>
>
The way I do it is to have a table/model for the feed_items, with a
created_at field (and also a feed model, which has_many feed_items).
Then in the Feed model I have a update_feeds class method which first
checks when the most recent feed_item for that feed was updated. If it's
less than 20 minutes ago(if !f.checked_at || f.checked_at <
20.minutes.ago), it checks the feed again; if not, it returns the
feed_items from the db.

The method's a little more complicated than that, so it doesn't replace
feed items it's already got, but that's the basic idea.

HTH
This topic is locked and can not be replied to.