Cache Sweepers and runner scripts that act on models?

I created a script that I call by ‘./script/runner -e production
UpdateItems.get_new_items()’, which basically calls the model Item:


I’ve set up a cache sweeper which removes caches after each
create/destroy/update on Item, and it works fine when accessing
controllers via the web server, but apparently doesn’t work via runner.
Controllers have a ‘cache_sweeper’ class method, but ActiveRecords don’t
(though they do have observer and filter methods, which is what sweepers
are a combination of). How can I get the cache sweeper to do its job
when adding items via a runner script? Am I supposed to call controller
methods instead? And if so, how? (I tried, but got a ‘uninitialized
constant ApplicationController’ error.)

thanks for any help!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs