Hi Bill, Are you using this version of merb-cache? http://github.com/benschwarz/merb-cache/
If not, I would recommend switching over. It's going to be the official version of merb-cache in the future, and IIRC the :uri => ... syntax only works on this branch. Sorry for the confusion, -Ben On Thu, Jan 15, 2009 at 11:49 AM, Bill Turner <[email protected]> wrote: > > Hi folks, > > Basically, I think I'm running into the problem described by otto on > the merbunity post: http://merbunity.com/tutorials/15 > > "What about eager caching in a typical blog situation? You want to > eager cache Post#index, and dirty for Post#create, or possible > Post#update. But in most situations, the update and create actions are > in an Admin controller. How do you tell a controller that it needs to > dirty whenever a different controller action is called?" > > How can you use eager_caching when your create/update actions are in a > controller separate from your show & index actions. In particular, > also dealing with clearing out related caches (sitemap & rss feeds - > also _not_ in the controller with create/update). > > I'm just going to focus on the feed action, since it will be hit most > often: > > So, in the public facing: app/controllers/posts.rb I have this at the > top: > > cache :feed > > And the caching works fine. > > Now, in app/controllers/admin/posts.rb I have tried just about > everything to get it to eager_cache - to refresh the cache set in the > other controller. Here are some variations of what I've tried: > > 1) at the top of the controller: > > eager_cache(:update, [Post :feed]) {{ :uri => build_url(:feed_posts)}} > eager_cache :update, [Post, :feed], :uri => url(:feed_posts) > eager_cache :update, [Post, :feed], :uri => '/posts/feed.rss' > > 2) in the update action: > > eager_cache([Post :feed]) {{ :uri => build_url(:feed_posts)}} > eager_cache [Post, :feed], :uri => url(:feed_posts) > eager_cache [Post, :feed], :uri => '/posts/feed.rss' > > And none of the above update the cache. > > If it helps, here's what's in my init.rb: > > Merb::Cache.setup do > unless defined? CACHE_SETUP > register(:action_store, Merb::Cache::ActionStore > [Merb::Cache::FileStore], :dir => Merb.root / "public" / "cache") > register(:default, Merb::Cache::AdhocStore[:action_store]) > end > CACHE_SETUP = true > end > > Thanks in advance for help on this. the caching is the last stumbling > block on my upgrade from a 0.9.6 app to a 1.0.7.1 app (oh, how the > caching was easier then :)) > > Bill > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
