Forum: Ruby on Rails Cache Sweepers and runner scripts that act on models?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
csn (Guest)
on 2006-01-27 02:59
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 topic is locked and can not be replied to.