开发者

Cache and Paginate RSS Feed in Rails

开发者 https://www.devze.com 2023-02-28 20:12 出处:网络
I\'m working on a life-streaming type app in Rails and am constantly parsing several different RSS feeds using Feedzirra. To support scaling of the app, I have to implement some kind of caching while

I'm working on a life-streaming type app in Rails and am constantly parsing several different RSS feeds using Feedzirra. To support scaling of the app, I have to implement some kind of caching while also allowing to paginate the cached results in the view. The cache can expire as little as once a day.

Being a novice to caching in Rails, what types of caching would be recommended for this? Also, I'm doing most of the feed parsing operations in modules in my lib/ directory, not sure if this would have affect / not be ideal for caching. Ideally I'd like to cache the array of results the RSS feed returns and do some post-processing to them before I send it to the view.

Any help wou开发者_运维知识库ld be much appreciated!


I suggest you to use a gem for run a schedule task in the cron, collect all desired results from all your rss feeds and save it to an xml or even in a table.

For the next time, load the results from this xml or table and create an static cached pages (html files).

And everytime you run your schedule task, erase your previous saved files, preventing old results tyo be displayed.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号