diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 00:07:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-31 00:07:58 +0300 |
commit | 0f0a8be306e7e0cd5693f57414de351808c41db9 (patch) | |
tree | d392e35e7b45c88de68cc5d433fac5ff98bb8504 /lib/gitlab/repository_cache_adapter.rb | |
parent | 3fe9588b1c1c4fb58f8ba8e9c27244fc2fc1c103 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/repository_cache_adapter.rb')
-rw-r--r-- | lib/gitlab/repository_cache_adapter.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/gitlab/repository_cache_adapter.rb b/lib/gitlab/repository_cache_adapter.rb index b2dc92ce010..6d216217bdf 100644 --- a/lib/gitlab/repository_cache_adapter.rb +++ b/lib/gitlab/repository_cache_adapter.rb @@ -58,11 +58,16 @@ 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| - if strong_memoized?(name) || !redis_set_cache.exist?(name) - return __send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend - end + 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) - redis_set_cache.include?(name, value) + __send__(name).include?(value) # rubocop:disable GitlabSecurity/PublicSend end end |