Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
5a08dee3
Commit
5a08dee3
authored
Jan 16, 2019
by
rinpatch
Browse files
cache ap_id in id instead of caching user two times
parent
76f80940
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
5a08dee3
...
...
@@ -445,7 +445,15 @@ def get_cached_by_ap_id(ap_id) do
def
get_cached_by_id
(
id
)
do
key
=
"id:
#{
id
}
"
Cachex
.
fetch!
(
:user_cache
,
key
,
fn
_
->
get_by_id
(
id
)
end
)
ap_id
=
Cachex
.
fetch!
(
:user_cache
,
key
,
fn
_
->
user
=
get_by_id
(
id
)
Cachex
.
put
(
:user_cache
,
"ap_id:
#{
user
.
ap_id
}
"
,
user
)
{
:commit
,
user
.
ap_id
}
end
)
get_cached_by_ap_id
(
ap_id
)
end
def
get_cached_by_nickname
(
nickname
)
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment