Documentation ¶
Index ¶
- Variables
- func APIKeyCacheKey(userId, keyId string) string
- func AccessTokenCacheKey(tokenId string) string
- func CodeCacheKey(code string) string
- func RefreshTokenCacheKey(tokenId string) string
- type EmailCodeCache
- type KeyCache
- type RedisApiKeyCache
- func (r RedisApiKeyCache) Del(ctx context.Context, userId, keyId string) error
- func (r RedisApiKeyCache) Find(ctx context.Context, keyId string) (entity.APIKey, bool, error)
- func (r RedisApiKeyCache) Get(ctx context.Context, userId, keyId string) (entity.APIKey, bool, error)
- func (r RedisApiKeyCache) Key(userId, keyId string) string
- func (r RedisApiKeyCache) List(ctx context.Context, userId string) ([]entity.APIKey, error)
- func (r RedisApiKeyCache) Set(ctx context.Context, apikey entity.APIKey, ttl time.Duration) error
- func (r RedisApiKeyCache) TTL(ctx context.Context, userId, keyId string) (time.Duration, error)
- type RedisEmailCodeCache
- func (c RedisEmailCodeCache) Check(ctx context.Context, code string) (string, error)
- func (c RedisEmailCodeCache) Del(ctx context.Context, code string) error
- func (c RedisEmailCodeCache) Get(ctx context.Context, code string) (string, error)
- func (c RedisEmailCodeCache) Set(ctx context.Context, code string, email string, expire time.Duration) error
- type RedisTokenCache
- func (t RedisTokenCache) Del(ctx context.Context, tokenId string) error
- func (t RedisTokenCache) Get(ctx context.Context, tokenId string) (string, bool, error)
- func (t RedisTokenCache) Key(tokenId string) string
- func (t RedisTokenCache) Set(ctx context.Context, tokenId string, token string, expire time.Duration) error
- func (t RedisTokenCache) TTL(ctx context.Context, tokenId string) (time.Duration, error)
- type TokenCache
Constants ¶
This section is empty.
Variables ¶
View Source
var EmailCodeCacheProvider = wire.NewSet( NewRedisEmailCodeCache, wire.Bind(new(EmailCodeCache), new(RedisEmailCodeCache)), )
View Source
var (
ErrDuplicateKey = errors.New("duplicate key")
)
Functions ¶
func APIKeyCacheKey ¶
func AccessTokenCacheKey ¶
func CodeCacheKey ¶
func RefreshTokenCacheKey ¶
Types ¶
type EmailCodeCache ¶
type KeyCache ¶
type KeyCache interface { Key(userId, keyId string) string TTL(ctx context.Context, userId, keyId string) (time.Duration, error) Get(ctx context.Context, userId, keyId string) (entity.APIKey, bool, error) Find(ctx context.Context, keyId string) (entity.APIKey, bool, error) Set(ctx context.Context, apikey entity.APIKey, ttl time.Duration) error Del(ctx context.Context, userId, keyId string) error List(ctx context.Context, userId string) ([]entity.APIKey, error) }
type RedisApiKeyCache ¶
type RedisApiKeyCache struct {
// contains filtered or unexported fields
}
func NewAPIKeyCache ¶
func NewAPIKeyCache(client *redis.Client) RedisApiKeyCache
func (RedisApiKeyCache) Del ¶
func (r RedisApiKeyCache) Del(ctx context.Context, userId, keyId string) error
func (RedisApiKeyCache) Key ¶
func (r RedisApiKeyCache) Key(userId, keyId string) string
type RedisEmailCodeCache ¶
type RedisEmailCodeCache struct {
// contains filtered or unexported fields
}
func NewRedisEmailCodeCache ¶
func NewRedisEmailCodeCache(source *data.DataSource) RedisEmailCodeCache
func (RedisEmailCodeCache) Del ¶
func (c RedisEmailCodeCache) Del(ctx context.Context, code string) error
type RedisTokenCache ¶
type RedisTokenCache struct {
// contains filtered or unexported fields
}
func NewAccessTokenCache ¶
func NewAccessTokenCache(d *data.DataSource) RedisTokenCache
func NewRefreshTokenCache ¶
func NewRefreshTokenCache(d *data.DataSource) RedisTokenCache
func (RedisTokenCache) Del ¶
func (t RedisTokenCache) Del(ctx context.Context, tokenId string) error
func (RedisTokenCache) Key ¶
func (t RedisTokenCache) Key(tokenId string) string
type TokenCache ¶
type TokenCache interface { TTL(ctx context.Context, tokenId string) (time.Duration, error) Key(tokenId string) string Get(ctx context.Context, tokenId string) (string, bool, error) Set(ctx context.Context, tokenId string, token string, expire time.Duration) error Del(ctx context.Context, tokenId string) error }
Click to show internal directories.
Click to hide internal directories.