46 lines
990 B
Go
46 lines
990 B
Go
package redis
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"time"
|
|
)
|
|
|
|
/*
|
|
模块名:缓存管理
|
|
描述:处理缓存数据过期问题
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Redis)
|
|
return m
|
|
}
|
|
|
|
type Redis struct {
|
|
modules.ModuleBase
|
|
expiredComp *ExpiredComp
|
|
}
|
|
|
|
//模块名
|
|
func (this *Redis) GetType() core.M_Modules {
|
|
return comm.ModuleEquipment
|
|
}
|
|
|
|
//模块初始化接口 注册用户创建角色事件
|
|
func (this *Redis) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
return
|
|
}
|
|
|
|
//装备组件
|
|
func (this *Redis) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.expiredComp = this.RegisterComp(new(ExpiredComp)).(*ExpiredComp)
|
|
}
|
|
|
|
//更新缓存数据过期时间
|
|
func (this *Redis) UpDateModel(key string, childs map[string]struct{}, expired time.Duration) {
|
|
this.expiredComp.UpDateModel(key, childs, expired)
|
|
}
|