cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SetCodeScript string
View Source
var VerifyCodeScript string

Functions

This section is empty.

Types

type ArticleCache

type ArticleCache interface {
	SetDetail(ctx context.Context, uid, id int64, art domain.Article) error
	GetDetail(ctx context.Context, uid, id int64) (domain.Article, error)
	GetPubDetail(ctx context.Context, uid int64, id int64) (domain.Article, error)
	SetPubDetail(ctx context.Context, uid int64, id int64, art domain.Article) error
}

func NewRedisArticleCache

func NewRedisArticleCache(cmd redis.Cmdable) ArticleCache

type CodeCache

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

func NewRedisCodeCache

func NewRedisCodeCache(cmd redis.Cmdable) CodeCache

type InteractiveCache

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

func NewInteractiveCache

func NewInteractiveCache(client redis.Cmdable) InteractiveCache

type LocalCodeCache

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

func (*LocalCodeCache) Set

func (l *LocalCodeCache) Set(ctx context.Context, biz, phone, code string) error

func (*LocalCodeCache) Verify

func (l *LocalCodeCache) Verify(ctx context.Context, biz, phone, code string) (bool, error)

type RedisCodeCache

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

func (*RedisCodeCache) Key

func (cache *RedisCodeCache) Key(biz string, phone string) string

func (*RedisCodeCache) Set

func (cache *RedisCodeCache) Set(ctx context.Context, biz string, phone string, code string) error

func (*RedisCodeCache) Verify

func (cache *RedisCodeCache) Verify(ctx context.Context, biz string, phone string, code string) (bool, error)

type RedisInteractiveCache

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

func (*RedisInteractiveCache) DecrLikeCntIfPresent

func (cache *RedisInteractiveCache) DecrLikeCntIfPresent(ctx context.Context, bizID int64, biz string) error

func (*RedisInteractiveCache) Get

func (*RedisInteractiveCache) IncrCollectCntIfPresent

func (cache *RedisInteractiveCache) IncrCollectCntIfPresent(ctx context.Context, bizID int64, id int64, biz string) error

func (*RedisInteractiveCache) IncrLikeCntIfPresent

func (cache *RedisInteractiveCache) IncrLikeCntIfPresent(ctx context.Context, bizID int64, biz string) error

func (*RedisInteractiveCache) IncrReadCntIfPresent

func (cache *RedisInteractiveCache) IncrReadCntIfPresent(ctx context.Context, bizID int64, biz string) error

func (*RedisInteractiveCache) Set

func (cache *RedisInteractiveCache) Set(ctx context.Context, id int64, biz string, int domain.Interactive) error

type RedisUserCache

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

func (*RedisUserCache) Get

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

func (*RedisUserCache) Key

func (cache *RedisUserCache) Key(id int64) string

func (*RedisUserCache) Set

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

type UserCache

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

func NewRedisUserCache

func NewRedisUserCache(client redis.Cmdable) UserCache

Jump to

Keyboard shortcuts

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