I currently have the following simple controller:
class SimpleController < ApplicationController def index @results = fetch_results end end
fetch_results is a fairly expensive operation so although the above works, I don't want to run it every time the page is refreshed. How can I decouple the updating of
@results so that it's updated on a fixed schedule, let's say every 15 minutes.
That way each time the page is loaded it will just return the current
@results value, which at worst would be 14 minutes and 59 seconds out of date.