Adds a method to clear the settings cache.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7804 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2011-11-13 15:20:31 +00:00
parent 3511292a17
commit b170a40ed4
2 changed files with 21 additions and 3 deletions
+8 -3
View File
@@ -151,11 +151,16 @@ class Setting < ActiveRecord::Base
def self.check_cache
settings_updated_on = Setting.maximum(:updated_on)
if settings_updated_on && @cached_cleared_on <= settings_updated_on
@cached_settings.clear
@cached_cleared_on = Time.now
logger.info "Settings cache cleared." if logger
clear_cache
end
end
# Clears the settings cache
def self.clear_cache
@cached_settings.clear
@cached_cleared_on = Time.now
logger.info "Settings cache cleared." if logger
end
private
# Returns the Setting instance for the setting named name