Commit b82131be authored by Kerri Miller's avatar Kerri Miller

More #write_to_redis_hash to private

parent 0c2fedc0
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment