cacheqm

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

Package cacheqm contains a caching quota.Manager implementation.

Index

Constants

View Source
const (
	// DefaultMinBatchSize is the suggested default for minBatchSize.
	DefaultMinBatchSize = 100

	// DefaultMaxCacheEntries is the suggested default for maxEntries.
	DefaultMaxCacheEntries = 1000
)

Variables

This section is empty.

Functions

func NewCachedManager

func NewCachedManager(qm quota.Manager, minBatchSize, maxEntries int) (quota.Manager, error)

NewCachedManager wraps a quota.Manager with an implementation that caches tokens locally.

minBatchSize determines the minimum number of tokens requested from qm for each GetTokens() request.

maxEntries determines the maximum number of cache entries, apart from global quotas. The oldest entries are evicted as necessary, their tokens replenished via PutTokens() to avoid excessive leakage.

Types

This section is empty.

Jump to

Keyboard shortcuts

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