cache

package
v2.3.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 (l LimiterCache) GetAttempts(ctx context.Context, key string) (int, error)

func (LimiterCache) GetTTL added in v2.3.24

func (l LimiterCache) GetTTL(ctx context.Context, key string) (time.Duration, error)

func (LimiterCache) IncrAttempts added in v2.3.24

func (l LimiterCache) IncrAttempts(ctx context.Context, key string, ttl time.Duration) (int, error)

func (LimiterCache) ResetAttempts added in v2.3.24

func (l LimiterCache) ResetAttempts(ctx context.Context, key string) error

func (LimiterCache) SetTTL added in v2.3.24

func (l LimiterCache) SetTTL(ctx context.Context, key string, ttl time.Duration) 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 (c *TokenCache) DeleteTokenByUidPid(ctx context.Context, userID int, DeviceID int, fields []string) error

func (*TokenCache) GetTokensWithoutError

func (c *TokenCache) GetTokensWithoutError(ctx context.Context, userID int, DeviceID int) (map[string]int, error)

func (*TokenCache) SetTokenFlag

func (c *TokenCache) SetTokenFlag(ctx context.Context, userID int, DeviceID int, token string, flag int) error

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

func (c *TokenCache) SetTokenMapByUidPid(ctx context.Context, userID int, DeviceID int, m map[string]int) error

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

func (*UserCache) GetUserInfo

func (u *UserCache) GetUserInfo(ctx context.Context, userID int, fn func(ctx context.Context) (*model.User, error)) (userInfo *model.User, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL