diff options
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 2985619fd2e..6262b5c4c92 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -94,6 +94,18 @@ class Repository gitlab_shell.rm_tag(path_with_namespace, tag_name) end + def round_commit_count + if commit_count > 10000 + '10000+' + elsif commit_count > 5000 + '5000+' + elsif commit_count > 1000 + '1000+' + else + commit_count + end + end + def branch_names cache.fetch(:branch_names) { raw_repository.branch_names } end @@ -118,29 +130,10 @@ class Repository cache.fetch(:size) { raw_repository.size } end - def cache_keys - %i(size branch_names tag_names commit_count graph_log - readme version contribution_guide changelog license) - end - - def build_cache - cache_keys.each do |key| - unless cache.exist?(key) - send(key) - end - end - end - def expire_cache - cache_keys.each do |key| - cache.expire(key) - end - end - - def rebuild_cache - cache_keys.each do |key| + %i(size branch_names tag_names commit_count graph_log + readme version contribution_guide changelog license).each do |key| cache.expire(key) - send(key) end end |