Answer the question
In order to leave comments, you need to log in
Download a resource every 10 minutes and cache it?
Let's say there is an external API: someexternalsvc.org/products.json. The controller must use this data to somehow process (for example, build a beautiful plate on it) and display it to the user. It is clear that pulling the external API for each request is wasteful (traffic, cap for the number of calls, and the data is rarely updated), so you can update the data every 10 minutes.
How are things like this implemented in production?
Since I am almost new to rails, I tried to google it. Current guess: you need to write a rake task that will be executed on an external timer (for example, on cron
y) and load json.
Where and how to store (cache) the downloaded data? Is there a way without writing to the database or to files (data ~ for a couple of KB)?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question