Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 00:07:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-31 00:07:58 +0300
commit0f0a8be306e7e0cd5693f57414de351808c41db9 (patch)
treed392e35e7b45c88de68cc5d433fac5ff98bb8504 /lib/gitlab/repository_set_cache.rb
parent3fe9588b1c1c4fb58f8ba8e9c27244fc2fc1c103 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/repository_set_cache.rb')
-rw-r--r--lib/gitlab/repository_set_cache.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/gitlab/repository_set_cache.rb b/lib/gitlab/repository_set_cache.rb
index 6d3ac53a787..8035946090a 100644
--- a/lib/gitlab/repository_set_cache.rb
+++ b/lib/gitlab/repository_set_cache.rb
@@ -25,7 +25,7 @@ module Gitlab
end
def read(key)
- with { |redis| redis.smembers(cache_key(key)) }
+ with { |redis| redis.sscan_each(cache_key(key)).to_a }
end
def write(key, value)
@@ -47,11 +47,10 @@ module Gitlab
end
def fetch(key, &block)
- if exist?(key)
- read(key)
- else
- write(key, yield)
- end
+ result = read(key)
+ return result unless result.empty?
+
+ write(key, yield)
end
def include?(key, value)