How can I clear a page cache. I tried impelemnting cache but switched it off, now my home page always loads the cached version. I tried the following rake task no luck.
namespace :cache_clear do
desc 'clear a page cache'
task :expire_cache => :environment do
ActionController::Base::expire_page('/')
puts "Cache cleared"
end
end
Here is my home page code, it shows partials that essentially present collection of other models. Does this have something to do with it?
<div class="span-17 last">
<%= render :partial => "top_votes" %>
</div>
<% content_for :right_nav do %>
<%= render :partial => "latest_votes" %>
<%= render :partial => "whos_voting" %>
<%= render :partial => "top_voters" %>
<% end %>
I even tried to expire the cache from a sweeper,
in my vote_topic controller I have
cache_sweeper :home_sweeper
class HomeSweeper < ActionController::Caching::Sweeper
observe VoteTopic
def after_index(vote_topic)
expire_cache(vote_topic)
end
def expire_cache(vote_topic)
expire_page :controller => :home, :action => :index
end
end
That doesn't work either, I do have cache turned off in my development.rb file.