Finish the System Cleanup feature.

This commit is contained in:
zicla
2019-04-04 03:14:47 +08:00
parent 7697891807
commit 5936f917b3
15 changed files with 158 additions and 15 deletions

View File

@ -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()
}