Add local groups as statistics

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-09-30 10:42:19 +02:00
parent 2dccd5eccd
commit a600720062
9 changed files with 79 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ defmodule Mobilizon.Service.Statistics do
A module that provides cached statistics
"""
alias Mobilizon.{Discussions, Events, Users}
alias Mobilizon.{Actors, Discussions, Events, Users}
def get_cached_value(key) do
case Cachex.fetch(:statistics, key, fn key ->
@@ -28,4 +28,20 @@ defmodule Mobilizon.Service.Statistics do
defp create_cache(:local_comments) do
Discussions.count_local_comments()
end
defp create_cache(:local_groups) do
Actors.count_local_groups()
end
defp create_cache(:federation_events) do
Events.count_events()
end
defp create_cache(:federation_comments) do
Discussions.count_comments()
end
defp create_cache(:federation_groups) do
Actors.count_groups()
end
end