Ok, So, I’m a bad developer and have never used any sort of cacheing
before. I decided it’s time I step up and I threw in some memcached
magic. I’m still pretty new to all this, so I’m confused on how some
things work. I’ve watched the railscast on cacheing, and gone through
many tutorials.
So, the problem I’m having is that I have this page being cached, and
it’s not updating the page when I do any sort of CRUD action on the
model primarily used on this page.
Here is what I have
class SiteController < ApplicationController
caches_action :index
def index
#this in my home page
end
en
class ListingsController < SiteController
#This is the page being cached
def index
@listings = Listing.all
end
end
class ListingSweeper < ActionController::Caching::Sweeper
observe Listing
def after_save(listing)
expire_cache(listing)
end
def after_update(listing)
expire_cache(listing)
end
def after_destroy(listing)
expire_cache(listing)
end
def expire_cache(listing)
expire_action root_path
expire_action listings_path
end
end
When I create a new Listing, or update or destroy an existing one, it
should clear the cache of the ListingsController#index, right?
When I go the the page, and refresh over and over, this is what pops up
in my production.log
Processing ListingsController#index (for 12.34.567.58 at 2010-03-31
17:13:29) [GET]
Filter chain halted as
[#<ActionController::Filters::AroundFilter:0x2aaaae2804c8
@options={:if=>nil, :unless=>nil, :only=>#<Set: {“contact”, “index”}>},
@method=#Proc:0x00002aaaac2a3ec0@/var/rails/app/releases/20100331171209/vendor/rails/actionpack/lib/action_controller/caching/actions.rb:64,
@kind=:filter, @identifier=nil>] did_not_yield.
Completed in 2ms (View: 0, DB: 0) | 200 OK
[http://245.254.135.24/listings]
Anyone have a good link for a tutorial I can get, or maybe an idea or
what I might be missing?
Any help is much appreciated!
Thanks,
~Jeremy