redisadapter

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package redisadapter 提供 ratelimit.Backend 的 Redis 实现。

该实现使用 Redis Lua 脚本维护共享 token bucket,并通过 KeyFunc 接收 外部 keyspace 映射规则。包内不定义项目级 key 名称、限流策略或降级语义。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBackend

func NewBackend(client redis.UniversalClient, keyFunc KeyFunc) ratelimit.Backend

NewBackend 创建一个基于 Redis 的 token bucket backend。

Types

type KeyFunc

type KeyFunc func(string) string

KeyFunc 将逻辑限流 key 映射为具体 Redis key。

Jump to

Keyboard shortcuts

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