cache

package
v0.0.0-...-d5c4f30 Latest Latest
Warning

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

Go to latest
Published: May 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotExist = redisv9.Nil

Functions

This section is empty.

Types

type APICache

type APICache interface {
	Set(ctx context.Context, api domain.API) error
	Get(ctx context.Context, id int64) (domain.API, error)
	Delete(ctx context.Context, id int64) error
}

func NewAPICache

func NewAPICache(cmd redisv9.Cmdable) APICache

type Cache

type Cache interface {
	Set(ctx context.Context, key string, val any, exp time.Duration) error
	Get(ctx context.Context, key string) ekit.AnyValue
}

type DoubleCache

type DoubleCache struct {
}

func (DoubleCache) Get

func (d DoubleCache) Get(ctx context.Context, key string) ekit.AnyValue

func (DoubleCache) Set

func (d DoubleCache) Set(ctx context.Context, key string, val any, exp time.Duration) error

type LocalCache

type LocalCache struct {
}

type NoteCache

type NoteCache interface {
	GetFirstPage(ctx context.Context, author int64) ([]domain.Note, error)
	SetFirstPage(ctx context.Context, author int64, notes []domain.Note) error
	DelFirstPage(ctx context.Context, author int64) error

	Set(ctx context.Context, note domain.Note) error
	Get(ctx context.Context, id int64) (domain.Note, error)

	// SetPub 正常来说,创作者和读者的 Redis 集群要分开,因为读者是一个核心中的核心
	SetPub(ctx context.Context, note domain.Note) error
	DelPub(ctx context.Context, id int64) error
	GetPub(ctx context.Context, id int64) (domain.Note, error)
}

func NewRedisNoteCache

func NewRedisNoteCache(client redisv9.Cmdable) NoteCache

type RankingCache

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

type RankingLocalCache

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

func NewRankingLocalCache

func NewRankingLocalCache() *RankingLocalCache

func (RankingLocalCache) ForceGet

func (r RankingLocalCache) ForceGet(ctx context.Context) ([]domain.Note, error)

func (RankingLocalCache) Get

func (RankingLocalCache) Preload

func (r RankingLocalCache) Preload(ctx context.Context)

func (RankingLocalCache) Set

func (r RankingLocalCache) Set(ctx context.Context, notes []domain.Note) error

type RankingRedisCache

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

func NewRankingRedisCache

func NewRankingRedisCache(client redisv9.Cmdable) *RankingRedisCache

func (*RankingRedisCache) Get

func (r *RankingRedisCache) Get(ctx context.Context) ([]domain.Note, error)

func (*RankingRedisCache) Set

func (r *RankingRedisCache) Set(ctx context.Context, notes []domain.Note) error

type RedisAPICache

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

func (*RedisAPICache) Delete

func (cache *RedisAPICache) Delete(ctx context.Context, id int64) error

func (*RedisAPICache) Get

func (cache *RedisAPICache) Get(ctx context.Context, id int64) (domain.API, error)

func (*RedisAPICache) Set

func (cache *RedisAPICache) Set(ctx context.Context, api domain.API) error

type RedisCache

type RedisCache struct {
}

type RedisNoteCache

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

func (*RedisNoteCache) DelFirstPage

func (r *RedisNoteCache) DelFirstPage(ctx context.Context, author int64) error

func (*RedisNoteCache) DelPub

func (r *RedisNoteCache) DelPub(ctx context.Context, id int64) error

func (*RedisNoteCache) Get

func (r *RedisNoteCache) Get(ctx context.Context, id int64) (domain.Note, error)

func (*RedisNoteCache) GetFirstPage

func (r *RedisNoteCache) GetFirstPage(ctx context.Context, author int64) ([]domain.Note, error)

func (*RedisNoteCache) GetPub

func (r *RedisNoteCache) GetPub(ctx context.Context, id int64) (domain.Note, error)

func (*RedisNoteCache) Set

func (r *RedisNoteCache) Set(ctx context.Context, note domain.Note) error

func (*RedisNoteCache) SetFirstPage

func (r *RedisNoteCache) SetFirstPage(ctx context.Context, author int64, notes []domain.Note) error

func (*RedisNoteCache) SetPub

func (r *RedisNoteCache) SetPub(ctx context.Context, note domain.Note) error

type RedisTaskCache

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

func (*RedisTaskCache) Delete

func (cache *RedisTaskCache) Delete(ctx context.Context, id int64) error

func (*RedisTaskCache) Get

func (cache *RedisTaskCache) Get(ctx context.Context, id int64) (domain.Task, error)

func (*RedisTaskCache) Set

func (cache *RedisTaskCache) Set(ctx context.Context, task domain.Task) error

type RedisUserCache

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

func (*RedisUserCache) Delete

func (cache *RedisUserCache) Delete(ctx context.Context, id int64) error

func (*RedisUserCache) Get

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

func (*RedisUserCache) Set

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

type TaskCache

type TaskCache interface {
	Set(ctx context.Context, task domain.Task) error
	Get(ctx context.Context, id int64) (domain.Task, error)
	Delete(ctx context.Context, id int64) error
}

func NewTaskCache

func NewTaskCache(cmd redisv9.Cmdable) TaskCache

type UserCache

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

func NewUserCache

func NewUserCache(cmd redisv9.Cmdable) UserCache

Jump to

Keyboard shortcuts

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