cache

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(ctx context.Context, key string, dest any) (bool, error)
	Set(ctx context.Context, key string, value any, ttl time.Duration) error
	Del(ctx context.Context, key string) error
	SetNX(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)
	IsExpired(ctx context.Context, key string) (bool, error)
	Close() error
}

type RedisCache

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

func NewRedisCache

func NewRedisCache(config util.Config) *RedisCache

NewRedisCache Redis 实现

func (*RedisCache) Close

func (r *RedisCache) Close() error

func (*RedisCache) Del

func (r *RedisCache) Del(ctx context.Context, key string) error

func (*RedisCache) Get

func (r *RedisCache) Get(ctx context.Context, key string, dest any) (bool, error)

func (*RedisCache) IsExpired

func (r *RedisCache) IsExpired(ctx context.Context, key string) (bool, error)

func (*RedisCache) Set

func (r *RedisCache) Set(ctx context.Context, key string, value any, ttl time.Duration) error

func (*RedisCache) SetNX

func (r *RedisCache) SetNX(ctx context.Context, key string, value interface{}, ttl time.Duration) (bool, error)

Directories

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

Jump to

Keyboard shortcuts

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