summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2017-05-15 15:04:09 +0300
committerValery Sizov <valery@gitlab.com>2017-05-15 22:51:53 +0300
commita6c0eb54dc23931aaa6dd5630bee036c62f86ff5 (patch)
tree9d8f2eeb55ccdede3c7ebfe7a7651708e7813da9 /app/models/user.rb
parente261b4b8517ba6d5d5b082f1955836c945fd51fc (diff)
downloadgitlab-ce-a6c0eb54dc23931aaa6dd5630bee036c62f86ff5.tar.gz
Invalidate cache for issue and MR counters more granularlycounters_cache_invalidation
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index c7160a6af14..088a7cb83d5 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -930,10 +930,18 @@ class User < ActiveRecord::Base
end
def invalidate_cache_counts
- Rails.cache.delete(['users', id, 'assigned_open_merge_requests_count'])
+ invalidate_issue_cache_counts
+ invalidate_merge_request_cache_counts
+ end
+
+ def invalidate_issue_cache_counts
Rails.cache.delete(['users', id, 'assigned_open_issues_count'])
end
+ def invalidate_merge_request_cache_counts
+ Rails.cache.delete(['users', id, 'assigned_open_merge_requests_count'])
+ end
+
def todos_done_count(force: false)
Rails.cache.fetch(['users', id, 'todos_done_count'], force: force) do
TodosFinder.new(self, state: :done).execute.count