diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb index d9090f189..120858e6b 100644 --- a/app/models/saved_search.rb +++ b/app/models/saved_search.rb @@ -41,6 +41,11 @@ class SavedSearch < ApplicationRecord (REDIS_EXPIRY.to_i - ttl).seconds.ago end memoize :refreshed_at + + def cached_size + SavedSearch.redis.scard("search:#{query}") + end + memoize :cached_size end concerning :Labels do diff --git a/app/views/saved_searches/index.html.erb b/app/views/saved_searches/index.html.erb index a65411a9e..746c6b07c 100644 --- a/app/views/saved_searches/index.html.erb +++ b/app/views/saved_searches/index.html.erb @@ -18,7 +18,9 @@ Query Labels - Last Refreshed + Posts + Refreshed + Created @@ -32,6 +34,7 @@ <%= link_to label, posts_path(:tags => "search:#{label}") %> <% end %> + <%= ss.cached_size if ss.cached_size > 0 %> <% if ss.refreshed_at.present? %> <%= time_ago_in_words_tagged ss.refreshed_at %> @@ -39,6 +42,7 @@ ><%= SavedSearch::REDIS_EXPIRY.inspect %> ago <% end %> + <%= time_ago_in_words_tagged ss.created_at %> <%= link_to "edit", edit_saved_search_path(ss) %> | <%= link_to "delete", saved_search_path(ss), :method => :delete, :remote => true %>