Jim, thanks for your help. - Brett
On Fri, Mar 12, 2010 at 12:21 PM, Jim Gay <[email protected]> wrote: > On Fri, Mar 12, 2010 at 2:01 PM, Brett Rasmussen > <[email protected]> wrote: > > Thanks for your response, Jim. As I've read about Rack::Cache (not > having > > been very familiar with Rack before), I've gotten a certain understanding > > that I'm not entirely sure is accurate and I'd like to ask your > confirmation > > on, or any advice you (or anyone else) might have. > > > > Here's what I think I understand: Since Rack::Cache is middleware, it > > operates completely independently of the Rails/Radiant application. > Apache > > talks to Rack::Cache, and Rack::Cache decides whether to return something > it > > has stored or go to the Rails/Radiant app for a fresh page. As such, > > Rails/Radiant has no say in what gets cached, when it gets cached, when > it > > gets refreshed, or what the cache key is named. Is this right? > > Not entirely. > Radiant sets up the values for cache control: > > http://github.com/radiant/radiant/blob/master/app/controllers/site_controller.rb#L7 > > http://github.com/radiant/radiant/blob/master/app/controllers/site_controller.rb#L46-L53 > So we do have control over it. > > > > > If so, does that mean that trying to do what I want to do is basically a > > lost cause if I stick with Rack::Cache? > > No, but you'll probably need to write your own rack middleware. > > > > > If so, does it make sense for me to just turn off normal Radiant caching > > altogether and roll my own caching solution inside of Rails/Radiant with > > something like memcached? I could insert that logic at the point of > > rendering--just check the cache for the right slug+locale combo before > > performing the render and return from the cache if found. > > That could be an option too, but might be more work than a new piece > of middleware. Although I've tried neither. > > > > > Am I barking up the right tree here? > > > > Thanks, > > Brett > > > > > > > > On Thu, Mar 11, 2010 at 1:44 PM, Jim Gay <[email protected]> wrote: > > > >> You're going to need to look at Rack Cache > >> > >> But in the radiant repo, look here > >> http://github.com/radiant/radiant/blob/master/lib/radiant/cache.rb > >> http://github.com/radiant/radiant/tree/master/vendor/rack-cache/ > >> > >> On Thu, Mar 11, 2010 at 3:35 PM, Brett Rasmussen > >> <[email protected]> wrote: > >> > I'd like to use Radiant's standard cache but have control over what > goes > >> > into it. Specifically, I'd like to store multiple rendered copies of > the > >> > same page with the same slug but with small pieces different based on > >> locale > >> > (which will probably just mean a session variable). > >> > > >> > So, for example, I'll have a "products" page at /products, and > everything > >> > will be the same throughout the page except a couple of prices. On > the > >> > prices, I'll show pounds for the UK and Euros for Ireland. > >> > > >> > I'm familiar with the multilingual_pages extension, but that is not > >> > acceptable because the customer requires that it be the exact same > slug, > >> not > >> > a separate one for each locale. > >> > > >> > So I just want to change how the rendered pages get put into and > pulled > >> out > >> > of the cache. I'd like to store them not just keyed off of the slug > but > >> by > >> > slug plus locale. Thus, each slug would be stored multiple > times--once > >> for > >> > each locale. Then, when I pull them out of the cache, I'll look for > the > >> > same slug+locale combo and send the matching entry on down. > >> > > >> > My question is this: Can someone point me to the right place in the > >> radiant > >> > code? Where is it that cache keys are created and rendered pages > stored > >> in > >> > the cache with said keys? I'm also open to other suggestions about > how > >> to > >> > approach this issue, but I'm especially interested in finding that > code > >> so I > >> > can monkey-patch it. I've looked through it and thus far haven't come > >> > across the obvious place. > >> > > >> > Thanks, > >> > Brett > >> > _______________________________________________ > >> > Radiant mailing list > >> > Post: [email protected] > >> > Search: http://radiantcms.org/mailing-list/search/ > >> > List Site: http://lists.radiantcms.org/mailman/listinfo/radiant > >> > Radiant: http://radiantcms.org > >> > Extensions: http://ext.radiantcms.org > >> > > >> > >> > >> > >> -- > >> Jim Gay > >> http://www.saturnflyer.com > >> _______________________________________________ > >> Radiant mailing list > >> Post: [email protected] > >> Search: http://radiantcms.org/mailing-list/search/ > >> List Site: http://lists.radiantcms.org/mailman/listinfo/radiant > >> Radiant: http://radiantcms.org > >> Extensions: http://ext.radiantcms.org > >> > > _______________________________________________ > > Radiant mailing list > > Post: [email protected] > > Search: http://radiantcms.org/mailing-list/search/ > > List Site: http://lists.radiantcms.org/mailman/listinfo/radiant > > Radiant: http://radiantcms.org > > Extensions: http://ext.radiantcms.org > > > > > > -- > Jim Gay > Saturn Flyer LLC > [email protected] > http://www.saturnflyer.com > 571-403-0338 > _______________________________________________ > Radiant mailing list > Post: [email protected] > Search: http://radiantcms.org/mailing-list/search/ > List Site: http://lists.radiantcms.org/mailman/listinfo/radiant > Radiant: http://radiantcms.org > Extensions: http://ext.radiantcms.org > _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ List Site: http://lists.radiantcms.org/mailman/listinfo/radiant Radiant: http://radiantcms.org Extensions: http://ext.radiantcms.org
