cache

package
v0.0.0-...-2cadb06 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSetCodeTooMany         = errors.New("发送验证码太频繁")
	ErrCodeVerifyTooManyTimes = errors.New("验证次数太多")
	ErrUnknowErrCode          = errors.New("我也不知道发生什么,反正是和code有关")
)
View Source
var ErrKeyNotExist = redis.Nil

Functions

This section is empty.

Types

type ArticleCache

type ArticleCache interface {
	GetFirstPage(ctx context.Context) ([]domain.Article, error)
	SetFirstPage(ctx context.Context, articles []domain.Article) error
	DeleteFirstPage(ctx context.Context)
}

type CodeCache

type CodeCache struct {
	// contains filtered or unexported fields
}

func NewCodeCache

func NewCodeCache(r redis.Cmdable, l *zap.Logger) *CodeCache

func (*CodeCache) Set

func (c *CodeCache) Set(ctx context.Context, biz, phone, code string) error

func (*CodeCache) Verify

func (c *CodeCache) Verify(ctx context.Context, biz, phone, inputCode string) (bool, error)

type InteractiveCache

type InteractiveCache interface {
	IncreaseReadCountIfPresent(ctx context.Context, biz string, bizId int64) error
}

type RedisArticleCache

type RedisArticleCache struct {
	// contains filtered or unexported fields
}

func NewRedisArticleCache

func NewRedisArticleCache(r redis.Cmdable, l *zap.Logger) *RedisArticleCache

func (*RedisArticleCache) DeleteFirstPage

func (ac *RedisArticleCache) DeleteFirstPage(ctx context.Context)

func (*RedisArticleCache) GetFirstPage

func (ac *RedisArticleCache) GetFirstPage(ctx context.Context) (articles []domain.Article, err error)

func (*RedisArticleCache) SetFirstPage

func (ac *RedisArticleCache) SetFirstPage(ctx context.Context, articles []domain.Article) error

type RedisInteractiveCache

type RedisInteractiveCache struct {
	// contains filtered or unexported fields
}

func NewRedisInteractiveCache

func NewRedisInteractiveCache(redis redis.Cmdable, logger *zap.Logger) *RedisInteractiveCache

func (*RedisInteractiveCache) IncreaseReadCountIfPresent

func (r *RedisInteractiveCache) IncreaseReadCountIfPresent(ctx context.Context, biz string, bizId int64) error

type RedisUserCache

type RedisUserCache struct {
	// contains filtered or unexported fields
}

func (*RedisUserCache) Get

func (cache *RedisUserCache) Get(ctx context.Context, id int64) (domain.User, error)

Get 只有 err 为 nil,就认为 u 是一定在的 如果没有数据,返回一个特定的 error

func (*RedisUserCache) Set

func (cache *RedisUserCache) Set(ctx context.Context, u domain.User) error

type UserCache

type UserCache interface {
	Get(ctx context.Context, id int64) (domain.User, error)
	Set(ctx context.Context, u domain.User) error
}

func NewRedisUserCache

func NewRedisUserCache(r redis.Cmdable, l *zap.Logger) UserCache

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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