Action Caching and After Filters

Hi there,

I’m using action caching, instead of page caching, because I’m using
filters in my controller.

class CommunityProgramController < ApplicationController

before_filter :login_required
after_filter :log_request

caches_action :show

In the log:
Cached fragment hit: views/site.com/community_programs/1 (0.2ms)
Filter chain halted as [#<ActionController::Filters::AroundFilter:
0x2a3a1540 …

I’m wondering if there’s a way to get after_filters working with
action caching. As far as I can tell what happens is, if an action has
been cached, the caches_action filter will halt the filter chain and
spit back the cached result. This means that any after_filters don’t
get run.

Is there some way to still have the after filters run ?
Are my assumptions correct about how this is working ?

Yes, I know I could change it to a before filter. I’ve done a little
bit of performance testing and it appears that the gain I get in using
action caching is cancelled out by needing log_request to be a before
filter instead of an after filter.

Thanks!

Luke