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
b82131be
Commit
b82131be
authored
Nov 26, 2019
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More #write_to_redis_hash to private
parent
0c2fedc0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
lib/gitlab/diff/highlight_cache.rb
lib/gitlab/diff/highlight_cache.rb
+12
-12
spec/lib/gitlab/diff/highlight_cache_spec.rb
spec/lib/gitlab/diff/highlight_cache_spec.rb
+1
-1
No files found.
lib/gitlab/diff/highlight_cache.rb
View file @
b82131be
...
...
@@ -47,6 +47,18 @@ module Gitlab
write_to_redis_hash
(
new_cache_content
)
end
def
clear
Redis
::
Cache
.
with
do
|
redis
|
redis
.
del
(
key
)
end
end
def
key
@redis_key
||=
[
'highlighted-diff-files'
,
diffable
.
cache_key
,
VERSION
,
diff_options
].
join
(
":"
)
end
private
# Given a hash of:
# { "file/to/cache" =>
# [ { line_code: "a5cc2925ca8258af241be7e5b0381edf30266302_19_19",
...
...
@@ -74,18 +86,6 @@ module Gitlab
end
end
def
clear
Redis
::
Cache
.
with
do
|
redis
|
redis
.
del
(
key
)
end
end
def
key
@redis_key
||=
[
'highlighted-diff-files'
,
diffable
.
cache_key
,
VERSION
,
diff_options
].
join
(
":"
)
end
private
def
file_paths
@file_paths
||=
@diff_collection
.
diffs
.
collect
(
&
:file_path
)
end
...
...
spec/lib/gitlab/diff/highlight_cache_spec.rb
View file @
b82131be
...
...
@@ -88,7 +88,7 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
let
(
:backend
)
{
Rails
.
cache
}
it
'creates or updates a Redis hash'
do
expect
{
cache
.
write_to_redis_hash
(
diff_hash
)
}
expect
{
cache
.
send
(
:write_to_redis_hash
,
diff_hash
)
}
.
to
change
{
Gitlab
::
Redis
::
Cache
.
with
{
|
r
|
r
.
hgetall
(
cache_key
)
}
}
end
end
...
...
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