cache

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 8 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 {
	Delete(key string)
	Store(key string, value string)
	Range(f func(key, value string) bool)
}

func NewRedisCache

func NewRedisCache(cache GlobalCache, prefix consts.RedisKey) Cache

type GlobalCache

type GlobalCache interface {
	HDel(ctx context.Context, prefix string, keys ...string) error
	HSet(ctx context.Context, prefix string, values ...[]byte) error
	HGet(ctx context.Context, prefix string, keys string) ([]byte, error)
	HGetAll(ctx context.Context, prefix string) (map[string][]byte, error)
	Get(ctx context.Context, key string) ([]byte, error)
	Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
	Del(ctx context.Context, keys ...string) error
	SetNX(ctx context.Context, key string, value []byte, ttl time.Duration) bool
	Exists(ctx context.Context, keys ...string) int64
	Close() error
}

func NewNutsDbCache

func NewNutsDbCache(opts ...NutsDbOption) (GlobalCache, error)

func NewRedisGlobalCache

func NewRedisGlobalCache(client *redis.Client) GlobalCache

type NutsDbOption

type NutsDbOption func(*nutsDbCache)

func WithBucket

func WithBucket(bucket string) NutsDbOption

func WithDB

func WithDB(db *nutsdb.DB) NutsDbOption

Jump to

Keyboard shortcuts

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