idempotent

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRedisNotEnabled = errors.New("redis not enabled")

ErrRedisNotEnabled 定义Redis未启用错误

Functions

func WithExpire

func WithExpire(min int) func(*Options)

WithExpire 设置过期时间(分钟)

func WithPrefix

func WithPrefix(prefix string) func(*Options)

WithPrefix 设置键前缀

func WithRedis

func WithRedis(rd redis.UniversalClient) func(*Options)

WithRedis 设置Redis客户端

Types

type Idempotent

type Idempotent struct {
	// contains filtered or unexported fields
}

Idempotent 幂等性检查结构体

func New

func New(options ...func(*Options)) *Idempotent

New 创建新的Idempotent实例

func (*Idempotent) Check

func (i *Idempotent) Check(ctx context.Context, token string) (bool, error)

Check 检查幂等性token

func (*Idempotent) Token

func (i *Idempotent) Token(ctx context.Context) (string, error)

Token 生成幂等性token

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options 配置选项结构体

Jump to

Keyboard shortcuts

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