开发者

How do I cache subdomain-specific views in Rails?

Our Rails app has some views that get heavy traffic but don't change too often (weekly at th开发者_JAVA技巧e most). I want to cache these views but we use subdomains to specify user accounts.

I've seen a few different blog posts on how to cache views based on subdomains. Just wondering what the preferred method is.

Also, one of the pages we need to cache is XML output. I don't know if that matters at all.


You just need to inject the things that change into your cache_key value when you cache. This may require using action caching instead of page caching. It sounds like you would need to inject the user id or the subdomain id when you're generating the cache_key for your content.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜