Rudy Lee
Rudy Lee

Reputation: 438

Automatically refresh Rails cache after expired

I am using page caching in my Rails app and I set up the cache to be expired be in 5 minutes.

Here is my controller code:

class HomeController < ApplicationController
  include HomeHelper

  caches_action :index, :expires_in => 5.minutes

  def index
    require 'feedzirra'

    @instagram = Instagram.user_recent_media('337349513', {:count => 15})
    @facebook = Feedzirra::Feed.fetch_and_parse('http://www.facebook.com/feeds/page.php?format=atom10&id=110243044484')
  end
end

Is it possible to refresh the cache automatically (after it expires ) without hitting the index action ?

Upvotes: 1

Views: 605

Answers (1)

Rudy Lee
Rudy Lee

Reputation: 438

I decided to use http://www.uptimerobot.com/ to visit my page every 5 minutes. It's also useful to check when there is down time.

Upvotes: 1

Related Questions