Finish the System Cleanup feature.
This commit is contained in:
@ -4,6 +4,7 @@ package rest
|
||||
type PreferenceService struct {
|
||||
Bean
|
||||
preferenceDao *PreferenceDao
|
||||
preference *Preference
|
||||
}
|
||||
|
||||
//初始化方法
|
||||
@ -17,3 +18,28 @@ func (this *PreferenceService) Init() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取单例的配置。
|
||||
func (this *PreferenceService) Fetch() *Preference {
|
||||
|
||||
if this.preference == nil {
|
||||
this.preference = this.preferenceDao.Fetch()
|
||||
}
|
||||
|
||||
return this.preference
|
||||
}
|
||||
|
||||
//清空单例配置。
|
||||
func (this *PreferenceService) Reset() {
|
||||
|
||||
this.preference = nil
|
||||
|
||||
}
|
||||
|
||||
//执行清理操作
|
||||
func (this *PreferenceService) Cleanup() {
|
||||
|
||||
this.logger.Info("[PreferenceService]执行清理:重置缓存中的preference。")
|
||||
|
||||
this.Reset()
|
||||
}
|
||||
|
Reference in New Issue
Block a user