Add Activity Pub endpoints cache

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-03-01 18:30:46 +01:00
parent b3a3001e90
commit a3ffc08e57
6 changed files with 104 additions and 43 deletions

View File

@@ -377,4 +377,8 @@ defmodule Mobilizon.Actors.Actor do
name -> name
end
end
def clear_cache(%Actor{preferred_username: preferred_username, domain: nil}) do
Cachex.del(:activity_pub, "actor_" <> preferred_username)
end
end

View File

@@ -37,12 +37,17 @@ defmodule Mobilizon.Application do
worker(
Cachex,
[
:json,
:activity_pub,
[
limit: 2500
limit: 2500,
expiration:
expiration(
default: :timer.minutes(3),
interval: :timer.seconds(15)
)
]
],
id: :cache_actor
id: :cache_activity_pub
),
worker(Guardian.DB.Token.SweeperServer, []),
worker(Mobilizon.Service.Federator, [])