I need to expire cached fragments from outside sweepers or
controllers: I have a rake task that calls a method inside a module in
the /lib directory. This task will be called at a scheduled time by a
crontab job.
After method execution I would like to expire some cached fragments.
I've just tried to import ActionController::Caching and
ActionController::Caching::Fragment, but without success.
I need to expire cached fragments from outside sweepers or
controllers: I have a rake task that calls a method inside a module in
the /lib directory. This task will be called at a scheduled time by a
crontab job.
After method execution I would like to expire some cached fragments.
I've just tried to import ActionController::Caching and
ActionController::Caching::Fragment, but without success.
Do you have any suggestions?
I had exactly the same problem and managed to come up with a solution
(albeit with a couple of limitations). My solution involves keeping all
the code in the Sweeper and calling it via a class method, so it should
work anywhere. See my blog entry for an explanation and the code.