summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-08-29 18:17:30 +0100
committerNick Thomas <nick@gitlab.com>2019-09-10 13:45:21 +0100
commit07323f44b74592e0991c5d3096e7fd0ca260fbab (patch)
treee9aae29c90354da8f3b9bb921fc2a2ac3860d741 /app/models/repository.rb
parent6ce21a9c1712c4c64b628fd65207c2f8eb7fc39d (diff)
downloadgitlab-ce-07323f44b74592e0991c5d3096e7fd0ca260fbab.tar.gz
Revert "Revert "Cache branch and tag names as Redis sets""
This reverts commit c6ccc07f48c7c1f9da43ecd82015500a4340544d.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 5cb4b56a114..6ed89ed2c32 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -239,13 +239,13 @@ class Repository
def branch_exists?(branch_name)
return false unless raw_repository
- branch_names.include?(branch_name)
+ branch_names_include?(branch_name)
end
def tag_exists?(tag_name)
return false unless raw_repository
- tag_names.include?(tag_name)
+ tag_names_include?(tag_name)
end
def ref_exists?(ref)
@@ -569,10 +569,10 @@ class Repository
end
delegate :branch_names, to: :raw_repository
- cache_method :branch_names, fallback: []
+ cache_method_as_redis_set :branch_names, fallback: []
delegate :tag_names, to: :raw_repository
- cache_method :tag_names, fallback: []
+ cache_method_as_redis_set :tag_names, fallback: []
delegate :branch_count, :tag_count, :has_visible_content?, to: :raw_repository
cache_method :branch_count, fallback: 0
@@ -1134,6 +1134,10 @@ class Repository
@cache ||= Gitlab::RepositoryCache.new(self)
end
+ def redis_set_cache
+ @redis_set_cache ||= Gitlab::RepositorySetCache.new(self)
+ end
+
def request_store_cache
@request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore)
end