cache

package module
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = store.ErrNotFound

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

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// List 返回当前缓存中的条目及其运行时元数据。
	List() ([]Entry, error)
	Get(key string) (string, error)
	// Incr 原子递增字符串数值键并返回递增后的值。
	Incr(key string) (int64, error)
	// GetDel 原子读取并删除缓存值。
	GetDel(key string) (string, error)
	Set(key string, value string, expire time.Duration) error
	Del(key string) error
	Expire(key string, dur time.Duration) error
	Exists(key string) bool

	HGetAll(key string) (map[string]string, error)
	HGet(key, field string) (string, error)
	HSet(key, field, value string) error
	HDel(key string, field string) error
	HExists(key, field string) error
}

func NewCache

func NewCache(cfg *configv1.Data_Redis) (Cache, func(), error)

type Entry added in v0.0.20

type Entry = store.Entry

Entry 表示一个缓存条目的只读快照。

type Item added in v0.0.16

type Item = store.Item

Item 是现代缓存接口的批量写入项。

type Store added in v0.0.16

type Store = store.Store

Store 是支持 context、GetDel、SetNX 和批量操作的缓存接口。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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