fixed EduSetting值1位时太短异常处理

This commit is contained in:
xxq250 2024-11-18 17:24:57 +08:00
parent 735a70bac6
commit 6287566eb8
1 changed files with 21 additions and 17 deletions

View File

@ -25,9 +25,13 @@ class EduSetting < ApplicationRecord
end
def self.get(key)
begin
Rails.cache.fetch(value_cache_key(key), expires_in: 1.days) do
find_by_name(key.to_s)&.value
end
rescue Exception => e
find_by_name(key.to_s)&.value
end
end
def self.value_cache_key(name)