diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2018-06-22 14:59:36 +0200 |
---|---|---|
committer | Imre Farkas <ifarkas@gitlab.com> | 2018-06-29 17:41:57 +0200 |
commit | d4d6528c863d48c9e2d30e6b5927ef01ec35e0e3 (patch) | |
tree | 68d1079afab2b1ebaabc855425889f253cd16c48 /lib | |
parent | 9c3214640cfb572af3cc419d159c11bcd5b5e624 (diff) | |
download | gitlab-ce-d4d6528c863d48c9e2d30e6b5927ef01ec35e0e3.tar.gz |
Expire correct method caches after HEAD changed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/repository_cache_adapter.rb | 10 |
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) |