contracts

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 2 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 {
	Exists(ctx context.Context, key string) (bool, error)
	Get(ctx context.Context, key string) ([]byte, error) // Err 返回可兼容为“不存在”
	Set(ctx context.Context, key string, val []byte, ttl time.Duration) error
	Delete(ctx context.Context, key string) error
	ScanDeleteByPrefix(ctx context.Context, prefix string) error
	Incr(ctx context.Context, key string) (int64, error) // 原子自增(用于标签版本)
}

Cache 缓存接口

type Serializer

type Serializer[T any] interface {
	Encode(v T) ([]byte, error)
	Decode(b []byte) (T, error)
}

Serializer 序列化处理器接口

Jump to

Keyboard shortcuts

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