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.any? %>
<div id="news-updates" data-id="<%= NewsUpdate.recent.first.try(:id) %>" style="display: none;">
<ul>
<% NewsUpdate.recent.each do |news_update| %>
<li><%= news_update.created_at.strftime("%b %d") %>: <%= news_update.message.html_safe %></li>
<% end %>
</ul>
<% if NewsUpdate.recent.present? %>
<div id="news-updates" data-id="<%= NewsUpdate.recent.first.try(:id) %>" style="display: none;">
<ul>
<% NewsUpdate.recent.each do |news_update| %>
<li><%= news_update.created_at.strftime("%b %d") %>: <%= news_update.message.html_safe %></li>
<% end %>
</ul>
<a href="#" id="close-news-ticker-link">close</a>
</div>
<% end %>
<a href="#" id="close-news-ticker-link">close</a>
</div>
<% end %>