tokencache

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache provides JWT token caching functionality.

func New

func New(defaultExpiration, cleanupInterval time.Duration, tokenGetter TokenGetter) *Cache

New creates a new token cache instance.

func (*Cache) GetToken

func (c *Cache) GetToken(ctx context.Context, key string) (string, error)

GetToken retrieves a token for the specified vehicle token ID If the token is not in the cache or has expired, it will fetch a new one.

type TokenGetter

type TokenGetter interface {
	GetToken(ctx context.Context, key string) (string, error)
}

TokenGetter defines a function type for retrieving new tokens.

Jump to

Keyboard shortcuts

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