Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 912241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:20:50+00:00 2026-05-15T17:20:50+00:00

How can I clear a page cache. I tried impelemnting cache but switched it

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:20:51+00:00Added an answer on May 15, 2026 at 5:20 pm

    The page cache is always on disk, so you will need to actually clear out the files/directory you want to flush. It’s an unfortunate way to cache.

     cache_dir = ActionController::Base.page_cache_directory
     unless cache_dir == RAILS_ROOT+"/public"
       FileUtils.rm_r(Dir.glob(cache_dir+"/*")) rescue Errno::ENOENT
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I clear browser cache of the page when I'm leaving it. // Clear
How can I clear or refresh the page in the browser using javascript? I
How can I clear all textboxes / uncheck checkboxes in my asp.net page without
I have an administrative page in a web application that resets the cache, but
I have set up sweepers to clear specific pages in the page cache when
How can I clear browser cache only on logout, sure I can use the
I know you can clear options by doing the following: dropDownList.options.length = 0; Is
Hoping someone can clear this up for me. Let's say I have 2 globals:
Hoping that someone can help clear up this very annoying situation I find myself
My question is how can i clear the editText field after i have saved

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.