remove some kludge-caching of :nil

that was only needed in rails 2

Change-Id: I1e2a00f65237d45ac82daa19eaecf5c589171718
Reviewed-on: https://gerrit.instructure.com/61025
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2015-08-17 10:45:29 -06:00
parent 1059861b7d
commit ee17716731
3 changed files with 5 additions and 7 deletions

View File

@ -101,9 +101,8 @@ class PluginSetting < ActiveRecord::Base
def self.cached_plugin_setting(name)
plugin_setting = MultiCache.fetch(settings_cache_key(name)) do
PluginSetting.find_by_name(name.to_s) || :nil
PluginSetting.find_by_name(name.to_s)
end
plugin_setting = nil if plugin_setting == :nil
plugin_setting
end
@ -121,7 +120,7 @@ class PluginSetting < ActiveRecord::Base
end
def self.settings_cache_key(name)
["settings_for_plugin2", name].cache_key
["settings_for_plugin3", name].cache_key
end
def clear_cache

View File

@ -60,7 +60,7 @@ module FeatureFlags
end
def feature_flag_cache_key(feature)
['feature_flag', self.class.name, self.global_id, feature.to_s].cache_key
['feature_flag2', self.class.name, self.global_id, feature.to_s].cache_key
end
# return the feature flag for the given feature that is defined on this object, if any.
@ -68,9 +68,8 @@ module FeatureFlags
def feature_flag(feature)
self.shard.activate do
result = MultiCache.fetch(feature_flag_cache_key(feature)) do
self.feature_flags.where(feature: feature.to_s).first || :nil
self.feature_flags.where(feature: feature.to_s).first
end
result = nil if result == :nil
result
end
end

View File

@ -304,7 +304,7 @@ describe "Feature Flags API", type: :request do
enable_cache do
flag = t_root_account.feature_flags.create! feature: 'course_feature', state: 'on'
# try to trick the controller into inserting (and violating a unique constraint) instead of updating
MultiCache.fetch(cache_key) { :nil }
MultiCache.fetch(cache_key) { nil }
api_call_as_user(t_root_admin, :put, "/api/v1/accounts/#{t_root_account.id}/features/flags/course_feature?state=off",
{ controller: 'feature_flags', action: 'update', format: 'json', account_id: t_root_account.to_param, feature: 'course_feature', state: 'off' })
end