tokencache

package
v7.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetricOperations = promauto.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "token_operation_seconds",
			Help:    "A histogram of latencies for token operations",
			Buckets: buckets,
		},
		[]string{"token", "op"},
	)
	MetricResponses = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Name: "token_responses",
			Help: "Response codes from token operations",
		},
		[]string{"token", "op", "code"},
	)
)

Functions

This section is empty.

Types

type Cache

type Cache struct {
	token.Token
	// contains filtered or unexported fields
}

Cache keys fetched from an underlying token

func New

func New(base token.Token, expiry time.Duration) *Cache

func (*Cache) GetKey

func (c *Cache) GetKey(ctx context.Context, keyName string) (token.Key, error)

type Metrics

type Metrics struct {
	token.Token
}

Metrics wraps a token and updates metrics when methods are called

func (Metrics) GetKey

func (m Metrics) GetKey(ctx context.Context, keyName string) (key token.Key, err error)

func (Metrics) Ping

func (m Metrics) Ping(ctx context.Context) (err error)

type RateLimited added in v7.6.0

type RateLimited struct {
	token.Token
	// contains filtered or unexported fields
}

func NewLimiter added in v7.6.0

func NewLimiter(base token.Token, limit float64, burst int) *RateLimited

func (*RateLimited) GetKey added in v7.6.0

func (r *RateLimited) GetKey(ctx context.Context, keyName string) (token.Key, error)

Jump to

Keyboard shortcuts

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