You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, sorry if my question sounds noobish but what is the difference between the config option cache_all_output vs. having to do something like
cache@user
in a template? Does cache_all_output save you from having to do this in each template and enable caching for every template? From my tests, it doesn't seem so. So what does cache_all_output do exactly?
The text was updated successfully, but these errors were encountered:
cache_all_output does indeed cache all templates without having to explicitly set a cache_key but the assumption is that the cache_key is the object. You still have to have caching enabled in Rails and setup the proper storage as you normally would for Rails caching. You can see the cached hits in the Rails log and by the lack of database queries that may be triggered from within the template itself.
The assumption when using cache_all_output is that when you partial a user - you'll always output the exact same user. If you want to output a different "template", you specify a different object name via :object_name => :different_name.
Meaning that if you cache user.cache_key under one of your templates, that's the cache entry that's going to be used for all templates matching user.cache_key. Every representation of user is a singleton of user.
If you want to represent the user twice, you can use:
Hi, sorry if my question sounds noobish but what is the difference between the config option
cache_all_output
vs. having to do something likein a template? Does
cache_all_output
save you from having to do this in each template and enable caching for every template? From my tests, it doesn't seem so. So what doescache_all_output
do exactly?The text was updated successfully, but these errors were encountered: