projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'remotes/origin/develop' into feature/object-hashtags...
[akkoma]
/
lib
/
pleroma
/
object.ex
diff --git
a/lib/pleroma/object.ex
b/lib/pleroma/object.ex
index 357a3b504777f653219d3a130c073e1abb52fdde..1d756bcd1743af73eb413999cddcfd120f15f62e 100644
(file)
--- a/
lib/pleroma/object.ex
+++ b/
lib/pleroma/object.ex
@@
-24,6
+24,8
@@
defmodule Pleroma.Object do
@derive {Jason.Encoder, only: [:data]}
@derive {Jason.Encoder, only: [:data]}
+ @cachex Pleroma.Config.get([:cachex, :provider], Cachex)
+
schema "objects" do
field(:data, :map)
schema "objects" do
field(:data, :map)
@@
-189,9
+191,9
@@
defmodule Pleroma.Object do
def get_cached_by_ap_id(ap_id) do
key = "object:#{ap_id}"
def get_cached_by_ap_id(ap_id) do
key = "object:#{ap_id}"
- with {:ok, nil} <-
C
achex.get(:object_cache, key),
+ with {:ok, nil} <-
@c
achex.get(:object_cache, key),
object when not is_nil(object) <- get_by_ap_id(ap_id),
object when not is_nil(object) <- get_by_ap_id(ap_id),
- {:ok, true} <-
C
achex.put(:object_cache, key, object) do
+ {:ok, true} <-
@c
achex.put(:object_cache, key, object) do
object
else
{:ok, object} -> object
object
else
{:ok, object} -> object
@@
-249,13
+251,13
@@
defmodule Pleroma.Object do
end
def invalid_object_cache(%Object{data: %{"id" => id}}) do
end
def invalid_object_cache(%Object{data: %{"id" => id}}) do
- with {:ok, true} <-
C
achex.del(:object_cache, "object:#{id}") do
-
C
achex.del(:web_resp_cache, URI.parse(id).path)
+ with {:ok, true} <-
@c
achex.del(:object_cache, "object:#{id}") do
+
@c
achex.del(:web_resp_cache, URI.parse(id).path)
end
end
def set_cache(%Object{data: %{"id" => ap_id}} = object) do
end
end
def set_cache(%Object{data: %{"id" => ap_id}} = object) do
-
C
achex.put(:object_cache, "object:#{ap_id}", object)
+
@c
achex.put(:object_cache, "object:#{ap_id}", object)
{:ok, object}
end
{:ok, object}
end