Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2018-06-22 15:59:36 +0300
committerImre Farkas <ifarkas@gitlab.com>2018-06-29 18:41:57 +0300
commitd4d6528c863d48c9e2d30e6b5927ef01ec35e0e3 (patch)
tree68d1079afab2b1ebaabc855425889f253cd16c48 /lib/gitlab/repository_cache_adapter.rb
parent9c3214640cfb572af3cc419d159c11bcd5b5e624 (diff)
Expire correct method caches after HEAD changed
Diffstat (limited to 'lib/gitlab/repository_cache_adapter.rb')
-rw-r--r--lib/gitlab/repository_cache_adapter.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/repository_cache_adapter.rb b/lib/gitlab/repository_cache_adapter.rb
index 7f64a8c9e46..2ec871f0754 100644
--- a/lib/gitlab/repository_cache_adapter.rb
+++ b/lib/gitlab/repository_cache_adapter.rb
@@ -25,6 +25,11 @@ module Gitlab
raise NotImplementedError
end
+ # List of cached methods. Should be overridden by the including class
+ def cached_methods
+ raise NotImplementedError
+ end
+
# Caches the supplied block both in a cache and in an instance variable.
#
# The cache key and instance variable are named the same way as the value of
@@ -67,6 +72,11 @@ module Gitlab
# Expires the caches of a specific set of methods
def expire_method_caches(methods)
methods.each do |key|
+ unless cached_methods.include?(key.to_sym)
+ Rails.logger.error "Requested to expire non-existent method '#{key}' for Repository"
+ next
+ end
+
cache.expire(key)
ivar = cache_instance_variable_name(key)