Documentation
¶
Overview ¶
@Time : 2019-07-12 16:42 @Author : zr
@Time : 2019-07-12 16:34 @Author : zr
Index ¶
- Constants
- type DB
- type Redis
- func (r Redis) CreateTokenMap(userId string, token string, channel string, expireAt time.Time) error
- func (r Redis) DeleteByToken(token string) error
- func (r Redis) FindAllSessionsByUserId(id string) (sessions []*model.Session, err error)
- func (r Redis) FindByToken(token string) (*model.Session, error)
- func (r Redis) SessionUpdate(s *model.Session) error
- func (r Redis) TokenMapTokenExpireAt(token string, expireAt time.Time) error
Constants ¶
View Source
const (
DefaultPrefix = "model"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface {
//首次插入session, 创建key为token的map
CreateTokenMap(userId string, token string, channel string, expireAt time.Time) error
//更新
SessionUpdate(*model.Session) error
//通过token查找session
FindByToken(token string) (*model.Session, error)
//通过UserId找到所有token
FindAllSessionsByUserId(id string) (sessions []*model.Session, err error)
//根据token删除session
DeleteByToken(token string) error
}
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func (Redis) CreateTokenMap ¶
func (Redis) DeleteByToken ¶
func (Redis) FindAllSessionsByUserId ¶ added in v1.0.3
Click to show internal directories.
Click to hide internal directories.