supervisor(Pleroma.Web.Endpoint, []),
# Start your own worker by calling: Pleroma.Worker.start_link(arg1, arg2, arg3)
# worker(Pleroma.Worker, [arg1, arg2, arg3]),
- worker(Cachex, [
- :user_cache,
+ worker(
+ Cachex,
[
- default_ttl: 25000,
- ttl_interval: 1000,
- limit: 2500
- ]
- ]),
+ :user_cache,
+ [
+ default_ttl: 25000,
+ ttl_interval: 1000,
+ limit: 2500
+ ]
+ ],
+ id: :cachex_user
+ ),
+ worker(
+ Cachex,
+ [
+ :object_cache,
+ [
+ default_ttl: 25000,
+ ttl_interval: 1000,
+ limit: 2500
+ ]
+ ],
+ id: :cachex_object
+ ),
worker(
Cachex,
[
else
key = "object:#{ap_id}"
- Cachex.fetch!(:user_cache, key, fn _ ->
+ Cachex.fetch!(:object_cache, key, fn _ ->
object = get_by_ap_id(ap_id)
if object do
def delete(%Object{data: %{"id" => id}} = object) do
with Repo.delete(object),
Repo.delete_all(Activity.all_non_create_by_object_ap_id_q(id)),
- {:ok, true} <- Cachex.del(:user_cache, "object:#{id}") do
+ {:ok, true} <- Cachex.del(:object_cache, "object:#{id}") do
{:ok, object}
end
end
Object.delete(cached_object)
- {:ok, nil} = Cachex.get(:user_cache, "object:#{object.data["id"]}")
+ {:ok, nil} = Cachex.get(:object_cache, "object:#{object.data["id"]}")
cached_object = Object.get_cached_by_ap_id(object.data["id"])