123456789101112131415161718192021222324252627282930313233343536373839 |
- package cache
- import (
- "time"
- "github.com/patrickmn/go-cache"
- )
- type UserServiceInterface interface {
-
- GetUserMode(userId string) string
- SetUserMode(userId, mode string)
- ClearUserMode(userId string)
-
- GetUserSessionContext(userId string) string
- SetUserSessionContext(userId, content string)
- ClearUserSessionContext(userId string)
-
- SetUseRequestCount(userId string, current int)
- GetUseRequestCount(uerId string) int
-
- SetAnswerID(userId, chattype string, current uint)
- GetAnswerID(uerId, chattype string) uint
- ClearAnswerID(userId, chattitle string)
- }
- var _ UserServiceInterface = (*UserService)(nil)
- type UserService struct {
-
- cache *cache.Cache
- }
- func NewUserService() UserServiceInterface {
- return &UserService{cache: cache.New(time.Hour*2, time.Hour*5)}
- }
|