Modify cache on home page (#1695)
This commit is contained in:
parent
be7fb2cdf0
commit
493e6fe796
2 changed files with 8 additions and 7 deletions
|
|
@ -83,7 +83,7 @@ class CacheBuster
|
|||
return unless article.published
|
||||
|
||||
article.tag_list.each do |tag|
|
||||
if article.published_at.to_i > 3.minutes.ago.to_i
|
||||
if article.published_at.to_i > 2.minutes.ago.to_i
|
||||
bust("/t/#{tag}/latest")
|
||||
bust("/t/#{tag}/latest?i=i")
|
||||
end
|
||||
|
|
@ -97,11 +97,12 @@ class CacheBuster
|
|||
bust("/api/articles?tag=#{tag}&top=#{i}")
|
||||
end
|
||||
end
|
||||
if Article.where(published: true).tagged_with(tag).
|
||||
order("hotness_score DESC").limit(2).pluck(:id).include?(article.id)
|
||||
bust("/t/#{tag}")
|
||||
bust("/t/#{tag}?i=i")
|
||||
end
|
||||
end
|
||||
if rand(2) == 1 &&
|
||||
Article.where(published: true).tagged_with(tag).
|
||||
order("hotness_score DESC").limit(2).pluck(:id).include?(article.id)
|
||||
bust("/t/#{tag}")
|
||||
bust("/t/#{tag}?i=i")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% cache("main-article-right-sidebar-discussions", :expires_in => 90.seconds) do %>
|
||||
<% cache("main-article-right-sidebar-discussions-#{params[:timeframe]}", :expires_in => (params[:timeframe].blank? ? 120 : 360 ).seconds) do %>
|
||||
<% @sidebar_ad = DisplayAd.where(approved: true, published: true, placement_area: "sidebar").first %>
|
||||
<% if @sidebar_ad %>
|
||||
<div class="widget">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue