I'm starting to work with fragment caching. Caching is working fine. Expiration isn't.
Rails: -r5553. Also tested against edge (-r5662) with the same results
Relevant (abbreviated) code:
class SsfController < ApplicationController
cache_sweeper :order_import_file_sweeper, :only => [:index]
# non-cached stuff, including @campaign
unless read_fragment(:action => 'index')
@results = @campaign.active_results
<!-- non-cached stuff -->
<%- cache do -%>
<%- if @results -%>
<table cellspacing="0" id="results">
<!-- big, expensive results table -->
<%- end -%>
<%- end -%>
<!-- more non-cached stuff -->
class OrderImportFileSweeper < ActionController::Caching::Sweeper
# If we import a new order import file, we want to expire cached
# data based on OrderImportFile data
expire_fragment(:controller => "ssf", :action => 'index')
I've used logger.error to make it logs to both the production and development logs, not because it's an error. I have config.action_controller.perform_caching = true in development.rb, and I can see that it's caching from the speed of the response, the fact that cache files are showing up in my specified cache directory, and that the development log includes "Cached fragment:" and "Read fragment" messages. I've tried both production and development environments with the same results.
I can also see that the expire_trd_ssf_campaign_results method is being called, as logging I'm doing within the method is being written to the logs. However, the cached fragment isn't being removed from the file system and I'm not seeing the cached fragment being refreshed.
What might I be doing wrong? What else should I be looking for?
Thanks for any and all advice and suggestions. Fragment caching looks to really improve the response time for some pages that involve pretty intense db queries in my app. I'd love to get it working
grzm seespotcode net