Shanti
Like I said I'm no rails expert, but if anyone else has this problem
this is what I did for my plugin.
Cheers,
Dallas
<% cache(:host => 'sportspyder.com', :action => 'team_articles',
:action_suffix => "articles_#{@team.id}_#{@filter}_#{@page}") do -%>
expire_fragment(/articles_#{@team.id}_all/, :host =>
'sportspyder.com', :controller => 'team')
expire_fragment(/headline/, :host => 'sportspyder.com', :path=>
'team/mlb/', :recursive=>false)
module ActionController
module Caching
module Fragments
class UnthreadedFileStore #:nodoc:
def delete_matched(matcher, options) #:nodoc:
path = @cache_path
if options[:controller] && options[:host]
path = "#{path}/#{options[:host]}/#{options[:controller]}"
elsif options[:path] && options[:host]
path = "#{path}/#{options[:host]}/#{options[:path]}"
end
return unless File.directory?(path)
recursive = [true, false].include?(options[:recursive]) ?
options[:recursive] : true
if path == @cache_path && recursive
ActionController::Base.logger.error("You are statting every
file in the cache directory. You should specify a host and controller
or path when using a regex for expiration. Regex [#{matcher}]")
end
search_dir(path, recursive) do |f|
if f =~ matcher
begin
File.delete(f)
rescue Object => e
# If there's no cache, then there's nothing to complain
about
end
end
end
end
def search_dir(dir, recursive=true, &callback)
Dir.foreach(dir) do |d|
next if d == "." || d == ".."
name = File.join(dir, d)
if File.directory?(name) && recursive
search_dir(name, recursive, &callback)
else
callback.call name
end
end
end
end
end
end
end