Documentation ¶
Index ¶
- type ILimiterCache
- type IPermissionCache
- type ITokenCache
- type IUserCache
- type LimiterCache
- func (l LimiterCache) GetAttempts(ctx context.Context, key string) (int, error)
- func (l LimiterCache) GetTTL(ctx context.Context, key string) (time.Duration, error)
- func (l LimiterCache) IncrAttempts(ctx context.Context, key string, ttl time.Duration) (int, error)
- func (l LimiterCache) ResetAttempts(ctx context.Context, key string) error
- func (l LimiterCache) SetTTL(ctx context.Context, key string, ttl time.Duration) error
- type PermissionCache
- type TokenCache
- func (c *TokenCache) DeleteAllUserTokens(ctx context.Context, userIDs ...int) error
- func (c *TokenCache) DeleteTokenByUidPid(ctx context.Context, userID int, DeviceID int, fields []string) error
- func (c *TokenCache) GetTokensWithoutError(ctx context.Context, userID int, DeviceID int) (map[string]int, error)
- func (c *TokenCache) SetTokenFlag(ctx context.Context, userID int, DeviceID int, token string, flag int) error
- func (c *TokenCache) SetTokenFlagEx(ctx context.Context, userID int, DeviceID int, token string, flag int) error
- func (c *TokenCache) SetTokenMapByUidPid(ctx context.Context, userID int, DeviceID int, m map[string]int) error
- type UserCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ILimiterCache ¶ added in v2.3.24
type ILimiterCache interface { GetAttempts(ctx context.Context, key string) (int, error) IncrAttempts(ctx context.Context, key string, ttl time.Duration) (int, error) SetTTL(ctx context.Context, key string, ttl time.Duration) error ResetAttempts(ctx context.Context, key string) error GetTTL(ctx context.Context, key string) (time.Duration, error) }
func NewLimiterCache ¶ added in v2.3.24
func NewLimiterCache(rdb redis.UniversalClient) ILimiterCache
type IPermissionCache ¶
type IPermissionCache interface { cache.BatchDeleter GetPermissionList(ctx context.Context, fn func(ctx context.Context) ([]model.Permission, error)) (list []model.Permission, err error) DelPermissionList() IPermissionCache }
func NewPermissionCache ¶
func NewPermissionCache(rdb redis.UniversalClient, rcClient *rockscache.Client, batchHandler cache.BatchDeleter) IPermissionCache
type ITokenCache ¶
type ITokenCache interface { SetTokenFlag(ctx context.Context, userID int, DeviceID int, token string, flag int) error SetTokenFlagEx(ctx context.Context, userID int, DeviceID int, token string, flag int) error GetTokensWithoutError(ctx context.Context, userID int, DeviceID int) (map[string]int, error) SetTokenMapByUidPid(ctx context.Context, userID int, DeviceID int, m map[string]int) error DeleteTokenByUidPid(ctx context.Context, userID int, DeviceID int, fields []string) error DeleteAllUserTokens(ctx context.Context, userIDs ...int) error }
func NewTokenCache ¶
func NewTokenCache(rdb redis.UniversalClient, accessExpire time.Duration) ITokenCache
type IUserCache ¶
type IUserCache interface { cache.BatchDeleter GetUserInfo(ctx context.Context, userID int, fn func(ctx context.Context) (*model.User, error)) (userInfo *model.User, err error) DelUsersInfo(userIDs ...int) IUserCache }
func NewUserCache ¶
func NewUserCache(rdb redis.UniversalClient, rcClient *rockscache.Client, batchHandler cache.BatchDeleter, accessExpire time.Duration) IUserCache
type LimiterCache ¶ added in v2.3.24
type LimiterCache struct {
// contains filtered or unexported fields
}
func (LimiterCache) GetAttempts ¶ added in v2.3.24
func (LimiterCache) IncrAttempts ¶ added in v2.3.24
func (LimiterCache) ResetAttempts ¶ added in v2.3.24
func (l LimiterCache) ResetAttempts(ctx context.Context, key string) error
type PermissionCache ¶
type PermissionCache struct { cache.BatchDeleter // contains filtered or unexported fields }
func (*PermissionCache) ClonePermissionCache ¶
func (u *PermissionCache) ClonePermissionCache() IPermissionCache
func (*PermissionCache) DelPermissionList ¶
func (u *PermissionCache) DelPermissionList() IPermissionCache
func (*PermissionCache) GetPermissionList ¶
func (u *PermissionCache) GetPermissionList(ctx context.Context, fn func(ctx context.Context) ([]model.Permission, error)) (list []model.Permission, err error)
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
func (*TokenCache) DeleteAllUserTokens ¶
func (c *TokenCache) DeleteAllUserTokens(ctx context.Context, userIDs ...int) error
func (*TokenCache) DeleteTokenByUidPid ¶
func (*TokenCache) GetTokensWithoutError ¶
func (*TokenCache) SetTokenFlag ¶
func (*TokenCache) SetTokenFlagEx ¶
func (c *TokenCache) SetTokenFlagEx(ctx context.Context, userID int, DeviceID int, token string, flag int) error
SetTokenFlagEx set token and flag with expire time
func (*TokenCache) SetTokenMapByUidPid ¶
type UserCache ¶
type UserCache struct { cache.BatchDeleter // contains filtered or unexported fields }
func (*UserCache) CloneUserCache ¶
func (u *UserCache) CloneUserCache() IUserCache
func (*UserCache) DelUsersInfo ¶
func (u *UserCache) DelUsersInfo(userIDs ...int) IUserCache
Click to show internal directories.
Click to hide internal directories.