Documentation
¶
Index ¶
- type Cache
- 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 Cache ¶ added in v2.4.0
type Cache struct {
LimiterCache *LimiterCache
PermissionCache *PermissionCache
TokenCache *TokenCache
UserCache *UserCache
}
func NewCache ¶ added in v2.4.0
func NewCache(rdb redis.UniversalClient, rcClient *rockscache.Client, batchHandler *cache.BatchDeleterRedis, accessExpire time.Duration) *Cache
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)
}
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
}
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
}
type IUserCache ¶
type LimiterCache ¶ added in v2.3.24
type LimiterCache struct {
// contains filtered or unexported fields
}
func NewLimiterCache ¶ added in v2.3.24
func NewLimiterCache(rdb redis.UniversalClient) *LimiterCache
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 NewPermissionCache ¶
func NewPermissionCache(rdb redis.UniversalClient, rcClient *rockscache.Client, batchHandler cache.BatchDeleter) *PermissionCache
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 NewTokenCache ¶
func NewTokenCache(rdb redis.UniversalClient, accessExpire time.Duration) *TokenCache
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 NewUserCache ¶
func NewUserCache(rdb redis.UniversalClient, rcClient *rockscache.Client, batchHandler cache.BatchDeleter) *UserCache
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.