package service import ( "blazing/cool" "blazing/modules/config/model" "github.com/gogf/gf/v2/database/gdb" ) type TalkConfigService struct { *cool.Service } func NewTalkConfigService() *TalkConfigService { return &TalkConfigService{ Service: &cool.Service{Model: model.NewMineralCollectionConfig()}, // Cache: gcache.New()}, } } func (s *TalkConfigService) GetCache(flag int) model.MineralCollectionConfig { var config model.MineralCollectionConfig cool.DBM(s.Model).Where("type", flag).Cache(gdb.CacheOption{ // Duration: time.Hour, Force: false, }).Scan(&config) return config }