You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
677 B
34 lines
677 B
|
7 years ago
|
package code
|
||
|
7 years ago
|
|
||
|
|
//@Service
|
||
|
|
type SessionService struct {
|
||
|
|
Bean
|
||
|
|
userDao *UserDao
|
||
|
|
sessionDao *SessionDao
|
||
|
|
}
|
||
|
|
|
||
|
|
//初始化方法
|
||
|
|
func (this *SessionService) Init() {
|
||
|
|
this.Bean.Init()
|
||
|
|
|
||
|
|
//手动装填本实例的Bean. 这里必须要用中间变量方可。
|
||
|
|
b := CONTEXT.GetBean(this.userDao)
|
||
|
|
if b, ok := b.(*UserDao); ok {
|
||
|
|
this.userDao = b
|
||
|
|
}
|
||
|
|
|
||
|
|
b = CONTEXT.GetBean(this.sessionDao)
|
||
|
|
if b, ok := b.(*SessionDao); ok {
|
||
|
|
this.sessionDao = b
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
//执行清理操作
|
||
|
|
func (this *SessionService) Cleanup() {
|
||
|
|
|
||
|
|
this.logger.Info("[SessionService]执行清理:清除缓存中所有Session记录,共%d条。", CONTEXT.SessionCache.Count())
|
||
|
|
|
||
|
|
CONTEXT.SessionCache.Truncate()
|
||
|
|
}
|