mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
fixed EduSetting值1位时太短异常处理
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: edu_settings
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# value :string(255)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# description :string(255)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_edu_settings_on_name (name) UNIQUE
|
||||
#
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: edu_settings
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# name :string(255)
|
||||
# value :string(255)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# description :string(255)
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_edu_settings_on_name (name) UNIQUE
|
||||
#
|
||||
|
||||
|
||||
class EduSetting < ApplicationRecord
|
||||
after_commit :expire_value_cache
|
||||
@@ -25,7 +25,11 @@ class EduSetting < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.get(key)
|
||||
Rails.cache.fetch(value_cache_key(key), expires_in: 1.days) do
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user