diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-27 03:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-27 03:09:34 +0300 |
commit | 5a80b10a845c1df6d73804090265a3da67c6acc4 (patch) | |
tree | a0cc9c6a4e5307c37b1b7ad51c186d7351a8b788 /lib/gitlab/repository_set_cache.rb | |
parent | a8324cd026394f672b0ae482aef0f5007fe1db8e (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.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gitlab/repository_set_cache.rb b/lib/gitlab/repository_set_cache.rb index 69c1688767c..def7b58a852 100644 --- a/lib/gitlab/repository_set_cache.rb +++ b/lib/gitlab/repository_set_cache.rb @@ -36,11 +36,18 @@ module Gitlab end def fetch(key, &block) - if exist?(key) - read(key) - else - write(key, yield) + full_key = cache_key(key) + + smembers, exists = with do |redis| + redis.multi do + redis.smembers(full_key) + redis.exists(full_key) + end end + + return smembers if exists + + write(key, yield) end end end |