cache some settings

we can SIGHUP if we ever change them

Change-Id: I0e7d0fa63ce0e368e890eb7ea8d5e657fa3820a1
Reviewed-on: https://gerrit.instructure.com/23729
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2013-08-26 10:28:44 -06:00
parent 87076e7a81
commit a8596e9b68
3 changed files with 5 additions and 5 deletions

View File

@ -232,15 +232,15 @@ class Account < ActiveRecord::Base
end
def terms_of_use_url
Setting.get('terms_of_use_url', 'http://www.instructure.com/policies/terms-of-use')
Setting.get_cached('terms_of_use_url', 'http://www.instructure.com/policies/terms-of-use')
end
def privacy_policy_url
Setting.get('privacy_policy_url', 'http://www.instructure.com/policies/privacy-policy-instructure')
Setting.get_cached('privacy_policy_url', 'http://www.instructure.com/policies/privacy-policy-instructure')
end
def terms_required?
Setting.get('terms_required', 'true') == 'true'
Setting.get_cached('terms_required', 'true') == 'true'
end
def require_acceptance_of_terms?(user)

View File

@ -117,7 +117,7 @@ class ContentParticipationCount < ActiveRecord::Base
# - unmuting an assignment with submissions
# - deleting a discussion/announcement/assignment/submission
def ttl
Setting.get('content_participation_count_ttl', 30.minutes).to_i
Setting.get_cached('content_participation_count_ttl', 30.minutes).to_i
end
private :ttl
end

View File

@ -172,7 +172,7 @@ class GradeSummaryPresenter
protected
def allow_loading_all_submissions?
threshold = Setting.get('grade_distributions_submission_count_threshold', '0').to_i
threshold = Setting.get_cached('grade_distributions_submission_count_threshold', '0').to_i
@context.allows_gradebook_uploads? && (threshold == 0 || @context.submissions.count < threshold)
end
end