summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-08 17:38:23 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-08 18:19:40 +0100
commitcb5a5ba09588af866aed595d960755bf4ced4483 (patch)
tree138d5dd36460bf07ed2665f42c8a8d9534ae821e /app/views
parent149a52b10f5d5715ad5868add8ae0d4d6389d46d (diff)
downloadgitlab-ce-cb5a5ba09588af866aed595d960755bf4ced4483.tar.gz
Cache & flush tag/branch counts
The methods used for this are Repository#tag_count and Repository#branch_count which cache their output in Redis as well as memoizing it in an instance variable. Both methods have a corresponding methods/hooks to flush the caches at the right time.
Diffstat (limited to 'app/views')
-rw-r--r--app/views/projects/branches/destroy.js.haml2
-rw-r--r--app/views/projects/commits/_head.html.haml4
2 files changed, 3 insertions, 3 deletions
diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml
index 882a4d0c5e2..a21ddaf4930 100644
--- a/app/views/projects/branches/destroy.js.haml
+++ b/app/views/projects/branches/destroy.js.haml
@@ -1 +1 @@
-$('.js-totalbranch-count').html("#{@repository.branches.size}")
+$('.js-totalbranch-count').html("#{@repository.branch_count}")
diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml
index 498c5e05b32..7a5b0d993db 100644
--- a/app/views/projects/commits/_head.html.haml
+++ b/app/views/projects/commits/_head.html.haml
@@ -15,9 +15,9 @@
= nav_link(html_options: {class: branches_tab_class}) do
= link_to namespace_project_branches_path(@project.namespace, @project) do
Branches
- %span.badge.js-totalbranch-count= @repository.branches.size
+ %span.badge.js-totalbranch-count= @repository.branch_count
= nav_link(controller: [:tags, :releases]) do
= link_to namespace_project_tags_path(@project.namespace, @project) do
Tags
- %span.badge.js-totaltags-count= @repository.tags.length
+ %span.badge.js-totaltags-count= @repository.tag_count