1234567891011121314151617181920212223242526272829303132333435 |
- 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
- }
- var _ UserServiceInterface = (*UserService)(nil)
- type UserService struct {
-
- cache *cache.Cache
- }
- func NewUserService() UserServiceInterface {
- return &UserService{cache: cache.New(time.Hour*2, time.Hour*5)}
- }
|