store

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("cache: key not found")

ErrNotFound 表示缓存键不存在或已经过期。

Functions

This section is empty.

Types

type Item

type Item struct {
	Key   string
	Value []byte
	TTL   time.Duration
}

Item 表示一个批量写入项。

type Store

type Store interface {
	Get(context.Context, string) ([]byte, error)
	// GetDel 原子读取并删除缓存值。
	GetDel(context.Context, string) ([]byte, error)
	Set(context.Context, string, []byte, time.Duration) error
	SetNX(context.Context, string, []byte, time.Duration) (bool, error)
	Delete(context.Context, string) error
	Has(context.Context, string) (bool, error)
	GetMulti(context.Context, []string) ([][]byte, error)
	SetMulti(context.Context, []Item) error
	Close() error
}

Store 定义面向字节值的现代缓存接口。

Jump to

Keyboard shortcuts

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