Page cache in rails

My homepage is pretty much the same for all users, which makes it a candidate for page caching. however, there are a few things that are user specific. For example, there is a nav element that is displayed only for registered users, and there is a link, for example, logout, my profile, etc. Created for specific users.

Should I use fragment caching instead? or should I use page caching and embed fragment caching for these specific elements? or what other methods can be achieved.

In addition, a navigation bar is created in the plugin (simple-nav), how can I control what is created inside the plugin regarding caching?

thank

+5
source share
1 answer

In this situation, you are mostly limited to fragment caching.

For the plugin, you probably have to take a look at the source to trigger a call on how to cache. If the plugin generates navigation as some content that you insert into the template, you can cache this fragment.

Depending on your audience, you might push non-cached items to JS. You can cache the entire page and then use JS to translate the login / logout links. Actually hardly worth the effort.

As with any performance optimization. Have you measured the performance of your system and collected indicators?

+1
source

All Articles