I have a few JavaScript that I would like to cache as follow :
layout1.erb has
.........
<%= javascript_include_tag 'jquery.min' ,
'rails_ujs',
'qwerty',
'jquery_editinplace',
'jquery.livequery',
'jquery.validate',
'ddsmoothmenu',
:cache=>"main_js_cache"
%>
...开发者_StackOverflow中文版.......
layout2.erb
.........
<%= javascript_include_tag 'jquery.min' ,
'rails_ujs',
'qwerty',
'jquery_editinplace',
'jquery.livequery',
'jquery.validate',
'ddsmoothmenu',
:cache=>"main_js_cache"
%>
..........
Now since the cache file name is same would the same be used or will it be generated again & again ?
I found the answer.. Left the question open incase others find it useful..
This is how caching goes..
First time suppose you render layout2.erb .. then it combines and generates a file called as "main_js_cache".
Next time you again render layout2.erb then it will just directly throw "main_js_cache" without regenerating it.
Suppose you render layout1.ebr in that case rails just looks for a file called "main_js_cache" it finds it and so it does NOT generate a new file.
加载中,请稍侯......
精彩评论