diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-11-01 08:30:10 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-11-01 08:41:46 +0000 |
commit | 2b3a40d0383f2ea79c1704c7700ff4d3e5f3c17a (patch) | |
tree | ceba2a125bf99162b54ebb41b015a5fc3f39a08c /lib | |
parent | 2c092ed355872cd08bf4caaf85625245764ccf77 (diff) | |
download | pleroma-2b3a40d0383f2ea79c1704c7700ff4d3e5f3c17a.tar.gz |
object: split object_cache from user_cache
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/application.ex | 30 | ||||
-rw-r--r-- | lib/pleroma/object.ex | 4 |
2 files changed, 25 insertions, 9 deletions
diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index a89728471..a6b921b45 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -16,14 +16,30 @@ defmodule Pleroma.Application do 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, [ diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index fddf38450..067ecfaf4 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -37,7 +37,7 @@ defmodule Pleroma.Object do 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 @@ -56,7 +56,7 @@ defmodule Pleroma.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 |