summaryrefslogtreecommitdiffstats
path: root/app/models/setting.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-13 15:20:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-11-13 15:20:31 +0000
commitb170a40ed43e522e80567ec8a7ab454cfaf765fa (patch)
tree59538365827f3466e990609a35d6c212ec1aec27 /app/models/setting.rb
parent3511292a177ad4b0121ebdfe8342f6dc9809c82a (diff)
downloadredmine-b170a40ed43e522e80567ec8a7ab454cfaf765fa.tar.gz
redmine-b170a40ed43e522e80567ec8a7ab454cfaf765fa.zip
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
Diffstat (limited to 'app/models/setting.rb')
-rw-r--r--app/models/setting.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb
index 12b186fe8..111193cae 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -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