cache

package
v0.0.0-...-0ca6d7b Latest Latest
Warning

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

Go to latest
Published: Jan 24, 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
}

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 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 InteractiveCache

type InteractiveCache interface {
	IncrReadCntIfPresent(ctx context.Context, biz string, bizID int64) error
	IncrLikeCntIfPresent(ctx context.Context, biz string, bizID int64) error
	DecrLikeCntIfPresent(ctx context.Context, biz string, bizID int64) error
	IncrCollectCntIfPresent(ctx context.Context, biz string, bizID int64) error
	DecrCollectCntIfPresent(ctx context.Context, biz string, bizID int64) error
	Get(ctx context.Context, biz string, bizID int64) (domain.Interactive, error)
	Set(ctx context.Context, biz string, bizID int64, intr domain.Interactive) error
}

type UserCache

type UserCache interface {
	Get(ctx context.Context, uid int64) (domain.User, error)
	Set(ctx context.Context, user 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