Cache poll participants
It looks like generating the poll takes sometime due to that method.
This commit is contained in:
@@ -104,7 +104,7 @@ class Poll::Stats
|
|||||||
end
|
end
|
||||||
|
|
||||||
stats_cache(*stats_methods)
|
stats_cache(*stats_methods)
|
||||||
stats_cache :voters, :recounts
|
stats_cache :participants, :voters, :recounts
|
||||||
|
|
||||||
def stats_cache(key, &block)
|
def stats_cache(key, &block)
|
||||||
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/v12", &block)
|
Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/v12", &block)
|
||||||
|
|||||||
Reference in New Issue
Block a user