On May 23, 10:27 am, ryanlonac <[email protected]> wrote: > Hi Jim, here is a link to handle caching. > > http://merbivore.com/documentation/1.0/doc/rdoc/merb-cache-1.0/index....
Hi, I saw that plus every other blog and doc on merb-cache that Google found. These cover the, I guess, "normal" use cases. However they do not work in my case which I presume is also a normal use case. I would think most people using page caching will use Apache mod_rewrite or nginx rewrite to display the cached page directly, so Merb never sees the request. If you do what is suggested in the docs it won't work because say you page cache the index page, you get index.html in your public folder, then you try to access index?page=2, this would switch to action cache, however you will still get index.html from Apache, as it ignores the parameters, and Merb won't see the request to deliver the action-cache version. So I converted all my page requests to index/page/1 etc, now page caches work. Now the problem is eager-cache doesn't really work with page caching and say a blog, where you may have to expire all the pages on a new comment, as the pages all have a side bar with the most recent comments. Hence I added a delete-all! which basically works, but you need to be careful that you put your cache in say public/cache and not public! The next problem I ran into is if I login to my blog as admin, I don't want to cache any of those pages, as they have delete/edit/etc buttons on each post and comment, if you use cache :index, :unless => :authenticated? then it forces the cache to use action caching only for some reason, page caching won't be used. So if you have page caching turned on in mod_rewrite then you will never see your admin adorned pages. My ultimate (and non-optimal) solution was to switch exclusively to action caching, and turn off page caching, slower but faster than not caching at all. I still need the delete_all! hack for filestore though as I still need to expire all action caches on a new comment (for now, I have a fix for that up my sleeve). My comments here are more to help others trying to use merb-cache for practical uses, I suspect that not many have used it in this context, or if they have they have not documented or blogged about it. I'll write a blog entry on what I discovered after this thread runs for a while, in case I am proven to be totally wrong and it turns out I can't RTFM (or missed something) ;) I would like to understand all the downsides of the delete_all! hack I mention in my previous post. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
