limiter

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachedTrafficLimiter

func NewCachedTrafficLimiter(limiter traffic.TrafficLimiter, opts ...Option) traffic.TrafficLimiter

Types

type Cache

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

func NewCache

func NewCache(cleanupInterval time.Duration) *Cache

func (*Cache) Get

func (c *Cache) Get(key string) *Item

func (*Cache) Set

func (c *Cache) Set(key string, item *Item)

type Item

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

func NewItem

func NewItem(v interface{}, d time.Duration) *Item

func (*Item) Expired

func (p *Item) Expired() bool

func (*Item) Value

func (p *Item) Value() interface{}

type Option added in v0.4.2

type Option func(*options)

func CleanupIntervalOption added in v0.4.2

func CleanupIntervalOption(interval time.Duration) Option

func RefreshIntervalOption added in v0.4.2

func RefreshIntervalOption(interval time.Duration) Option

func ScopeOption added in v0.4.2

func ScopeOption(scope string) Option

Jump to

Keyboard shortcuts

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