I have a small patch at
and I'd be interested in your feedback. It is extracted from my
current project; motivation was to easily expire file-based fragments
for different hostnames where application runs.
It adds expire_fragment_by_glob() method to
ActionController::Caching::Fragments and takes the "glob" string as
argument, same as the Ruby's `Dir` or `Dir#glob`, which I think is
great option for matching filesystem paths.
I don't know if file-based fragment cache is getting out of fashion in
current development, so would like to know your opinion.
I added another method, because there is complex switching logic in
expire_fragment (Hash? Regexp?) already. Maybe someone more
knowledgeable could refactor it with something like key.is_a?(String)
&& key.include?('*') in the expire_fragment() method... I am quite
sure the implementation could be done better :), but I don't know my
way around Rails so well....
Here's the gist of it: http://gist.github.com/5708 (same as attachment
to Lighthouse ticket, but with syntax coloring)