cache

package module
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 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 {
	Get(key string) (string, 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 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
Package local 提供基于 FreeCache 的进程内缓存。
Package local 提供基于 FreeCache 的进程内缓存。
Package store 定义支持 context、原子消费、原子写入和批量操作的缓存契约。
Package store 定义支持 context、原子消费、原子写入和批量操作的缓存契约。

Jump to

Keyboard shortcuts

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