7992 wrap local_posts from statistics in a cache
This commit is contained in:
parent
ba905334f7
commit
d4331f4e65
1 changed files with 6 additions and 4 deletions
|
|
@ -105,11 +105,13 @@ class NodeInfoPresenter
|
||||||
end
|
end
|
||||||
|
|
||||||
def local_posts
|
def local_posts
|
||||||
|
Rails.cache.fetch("NodeInfoPresenter/local_posts", expires_in: 1.hours) do
|
||||||
@local_posts ||= Post.where(type: "StatusMessage")
|
@local_posts ||= Post.where(type: "StatusMessage")
|
||||||
.joins(:author)
|
.joins(:author)
|
||||||
.where("owner_id IS NOT null")
|
.where("owner_id IS NOT null")
|
||||||
.count
|
.count
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def local_comments
|
def local_comments
|
||||||
@local_comments ||= Comment.joins(:author)
|
@local_comments ||= Comment.joins(:author)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue