cache

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownCache is returned when a cache implementation is
	// requested that has not been registered to the server.
	ErrUnknownCache = errors.New("requested cache is not known")

	// ErrNoCachedToken is returned for a cache miss when asking
	// for a specific owner.  This error should generally prompt
	// the token to be obtained from the server, but may handle
	// terminal failures in the event that a cached token was
	// specifically requested.
	ErrNoCachedToken = errors.New("no cached token for that owner")
)

Functions

func GetTokenCacheList

func GetTokenCacheList() []string

GetTokenCacheList returns a list of token caches that are currently registered to the system.

func RegisterTokenCacheFactory

func RegisterTokenCacheFactory(name string, f TokenCacheFactory)

RegisterTokenCacheFactory can be used by token caches on import to register themselves. Names must be unique.

Types

type TokenCache

type TokenCache interface {
	PutToken(string, string) error
	GetToken(string) (string, error)
	DelToken(string) error
}

The TokenCache is an interface that allows many possible token caches to be used to improve token efficiency.

func NewTokenCache

func NewTokenCache(name string) (TokenCache, error)

NewTokenCache returns a token cache that's setup and ready for use. While its not expected that this function will be called outside of this package, there are some rare circumstances that it would be useful to initialize a cache for private use.

type TokenCacheFactory

type TokenCacheFactory func() (TokenCache, error)

A TokenCacheFactory is a function that returns a TokenCache. This should generally not be an exported function in the implementation, and is instead registered here on import.

Directories

Path Synopsis
Package fs implements a filesystem based token cache.
Package fs implements a filesystem based token cache.
Package memory implements an in-memory token cache.
Package memory implements an in-memory token cache.

Jump to

Keyboard shortcuts

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