In a project I'm working on, I'm requesting data from an external API in my controller, which is then displayed in the view. I've recently begun running into exceptions being thrown due to rate limits, which are caused from excessive calls to the API. To fix this, I'm assuming that I need to implement some sort of caching system. I've been reading up on page caching in rails, and it doesn't seem to solve my problem, since I'm not using models from my own database. So, I was wondering if there was a simple way to cache the page on a timed basis, so that new data could be requested through the API every so often.
Hope this makes sense--I'm fairly new to Ruby on Rails, and I've never worked with any sort of caching system before.
Memcached has the time-based expiration you're talking about, and is quite excellent for caching most common objects, including pages, I believe.
It's really easy to install and Rails comes ready to use it a with one-line configuration for memcached.
The following screencast was very helpful for learning about memcached:
http://railslab.newrelic.com/2009/02/19/episode-8-memcached
Actually, I recommend the entire series, as it's tremendously useful.
Here's the memcached site:
If you're more a manual type, you could always create a cron job that runs once every few minutes and generates the new file.
Hope this helps!