Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
396f92d0
Commit
396f92d0
authored
Nov 04, 2019
by
Andrew Newdigate
Committed by
Kamil Trzciński
Nov 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Improves the performance of the Redis set cache"
This reverts commit
389e6f58
.
parent
f5a64c57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
14 deletions
+10
-14
lib/gitlab/repository_cache_adapter.rb
lib/gitlab/repository_cache_adapter.rb
+4
-9
lib/gitlab/repository_set_cache.rb
lib/gitlab/repository_set_cache.rb
+6
-5
No files found.
lib/gitlab/repository_cache_adapter.rb
View file @
396f92d0
...
...
@@ -58,16 +58,11 @@ module Gitlab
# wrong answer. We handle that by querying the full list - which fills
# the cache - and using it directly to answer the question.
define_method
(
"
#{
name
}
_include?"
)
do
|
value
|
return
__send__
(
name
).
include?
(
value
)
if
strong_memoized?
(
name
)
# rubocop:disable GitlabSecurity/PublicSend
# If the member exists in the set, return as such early.
return
true
if
redis_set_cache
.
include?
(
name
,
value
)
# If it did not, make sure the collection exists.
# If the collection exists, then item does not.
return
false
if
redis_set_cache
.
exist?
(
name
)
if
strong_memoized?
(
name
)
||
!
redis_set_cache
.
exist?
(
name
)
return
__send__
(
name
).
include?
(
value
)
# rubocop:disable GitlabSecurity/PublicSend
end
__send__
(
name
).
include?
(
value
)
# rubocop:disable GitlabSecurity/PublicSend
redis_set_cache
.
include?
(
name
,
value
)
end
end
...
...
lib/gitlab/repository_set_cache.rb
View file @
396f92d0
...
...
@@ -25,7 +25,7 @@ module Gitlab
end
def
read
(
key
)
with
{
|
redis
|
redis
.
s
scan_each
(
cache_key
(
key
)).
to_a
}
with
{
|
redis
|
redis
.
s
members
(
cache_key
(
key
))
}
end
def
write
(
key
,
value
)
...
...
@@ -47,10 +47,11 @@ module Gitlab
end
def
fetch
(
key
,
&
block
)
result
=
read
(
key
)
return
result
unless
result
.
empty?
write
(
key
,
yield
)
if
exist?
(
key
)
read
(
key
)
else
write
(
key
,
yield
)
end
end
def
include?
(
key
,
value
)
...
...
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