views: don't cache news updates.

Don't fragment cache the site news banner. Caching this trades a SQL
query for a Redis call, which is unlikely to make much performance
difference to page rendering but puts high traffic volume on Redis.
This commit is contained in:
evazion
2020-12-01 19:11:05 -06:00
parent 0be0395776
commit facc73f23f

View File

@@ -1,13 +1,11 @@
<% cache("news-updates", :expires_in => 1.hour) do %> <% if NewsUpdate.recent.present? %>
<% if NewsUpdate.recent.any? %> <div id="news-updates" data-id="<%= NewsUpdate.recent.first.try(:id) %>" style="display: none;">
<div id="news-updates" data-id="<%= NewsUpdate.recent.first.try(:id) %>" style="display: none;"> <ul>
<ul> <% NewsUpdate.recent.each do |news_update| %>
<% NewsUpdate.recent.each do |news_update| %> <li><%= news_update.created_at.strftime("%b %d") %>: <%= news_update.message.html_safe %></li>
<li><%= news_update.created_at.strftime("%b %d") %>: <%= news_update.message.html_safe %></li> <% end %>
<% end %> </ul>
</ul>
<a href="#" id="close-news-ticker-link">close</a> <a href="#" id="close-news-ticker-link">close</a>
</div> </div>
<% end %>
<% end %> <% end %>