summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-08-19 20:26:02 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-08-19 20:26:02 +0000
commit9295cc6f2a4e1fcfa90207a6b4a832ad49aa2ad6 (patch)
tree006bd8bae76c64e11b2daa97ee6ea8578c46b66e /app
parentfede390ce8a3edfae8dca04612d0039a4ed01572 (diff)
parent0eff75fa2b6691b6fba31fcc2842f51debd249a9 (diff)
downloadgitlab-ce-9295cc6f2a4e1fcfa90207a6b4a832ad49aa2ad6.tar.gz
Merge branch '64251-branch-name-set-cache' into 'master'
Cache branch and tag names as Redis sets See merge request gitlab-org/gitlab-ce!30476
Diffstat (limited to 'app')
-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 6f63cd32da4..b957b9b0bdd 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)
@@ -565,10 +565,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
@@ -1130,6 +1130,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