开发者

Scaling Rails with Cache-on-write

开发者 https://www.devze.com 2022-12-13 17:40 出处:网络
I currently have a rails app that uses the traditional caching.cache do blocks are used to cache slow-rendering partials.This works great for the most part, except for a few pages which take too long

I currently have a rails app that uses the traditional caching. cache do blocks are used to cache slow-rendering partials. This works great for the most part, except for a few pages which take too long to render on t开发者_如何学Pythonhe first read.

I'd like to move the rendering of these partials to the write-side from the read-side, by rendering in either the model or in sweepers when the underlying data changes. Preferably, this would be in the sweepers that already invalidate the cache keys. Is this a good approach? Is there a "right" way to do this?


Is it the actual partial that is taking a while to render or the queries required to actually get the data? If it's the latter you're better off caching those in a write-through manner, it might be simpler than trying to update cached partials on write.

0

精彩评论

暂无评论...
验证码 换一张
取 消