cache

package
v0.0.0-...-24b49fa Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Cache access

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeSendTooMany   = errors.New("too frequent send requests")
	ErrCodeVerifyTooMany = errors.New("too frequent verify requests")
	ErrKeyNotExist       = errors.New("inexisted key")
)

Functions

This section is empty.

Types

type ArticleCache

type ArticleCache interface {
	GetFirstPage(ctx context.Context, uid int64) ([]domain.Article, error)
	SetFirstPage(ctx context.Context, uid int64, articles []domain.Article) error
	DelFirstPage(ctx context.Context, uid int64) error
	Get(ctx context.Context, id int64) (domain.Article, error)
	Set(ctx context.Context, article domain.Article) error
	GetPub(ctx context.Context, id int64) (domain.Article, error)
	SetPub(ctx context.Context, article domain.Article) error
	BatchGetPub(ctx context.Context, ids []int64) ([]domain.Article, error)
	BatchSetPub(ctx context.Context, articles []domain.Article) error
}

type BaseArticleCache

type BaseArticleCache struct{}

func (*BaseArticleCache) Key

func (c *BaseArticleCache) Key(motif string, uid int64) string

type BaseCodeCache

type BaseCodeCache struct{}

func (*BaseCodeCache) Key

func (b *BaseCodeCache) Key(biz, phone string) string

type BaseInteractiveCache

type BaseInteractiveCache struct{}

func (*BaseInteractiveCache) Key

func (c *BaseInteractiveCache) Key(biz string, bizID int64) string

type BaseRankingCache

type BaseRankingCache struct{}

func (*BaseRankingCache) Key

func (c *BaseRankingCache) Key(biz string) string

type BaseUserCache

type BaseUserCache struct{}

func (*BaseUserCache) Key

func (c *BaseUserCache) Key(uid int64) string

type CodeCache

type CodeCache interface {
	Set(ctx context.Context, biz, phone, code string) error
	Verify(ctx context.Context, biz, phone, code string) (bool, error)
}

type RankingCache

type RankingCache interface {
	Set(ctx context.Context, arts []domain.Article) error
	Get(ctx context.Context) ([]domain.Article, error)
}

type UserCache

type UserCache interface {
	Get(ctx context.Context, uid int64) (domain.User, error)
	Set(ctx context.Context, user domain.User) error
	BatchGet(ctx context.Context, uids []int64) ([]domain.User, error)
	BatchSet(ctx context.Context, users []domain.User) error
}

Directories

Path Synopsis
Package cachemocks is a generated GoMock package.
Package cachemocks is a generated GoMock package.
mocks
Package redismock is a generated GoMock package.
Package redismock is a generated GoMock package.

Jump to

Keyboard shortcuts

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