Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetManager ¶
func SetManager(m Manager)
SetManager sets the global cache manager, which is used to instantiate all caches. Setting this to nil disables caching.
Types ¶
type Cache ¶
type Cache interface { // Read returns a reader for the cache value, if found and not expired // or errors when unable to find / expired Read(key string) (ReaderAtCloser, error) // Write writes the contents of the reader to the cache // and closes it, if the reader implements io.Closer Write(key string, contents io.Reader) error }
Cache is what the application interacts with to get and set cached data
type Manager ¶
type Manager interface { // GetCache returns a cache scoped to the given named, versioned data GetCache(name, version string) Cache // RootDirs returns any root directories this cache manager uses RootDirs() []string }
Manager is responsible for managing cache data and instantiating all caches
func GetManager ¶
func GetManager() Manager
GetManager returns the global cache manager, which is used to instantiate all caches
func NewFromDir ¶
NewFromDir creates a new cache manager which returns caches stored on disk, rooted at the given directory
func NewInMemory ¶
NewInMemory returns an in-memory only cache manager
type ReaderAtCloser ¶
ReaderAtCloser is an amalgamation of: io.Reader, io.ReaderAt, and io.Closer
type Resolver ¶
type Resolver[T any] interface { // Resolve attempts to resolve the given key from cache and convert it to the type of the cache, // or calls the resolver function if unable to resolve a cached value Resolve(key string, resolver resolverFunc[T]) (T, error) }
Resolver interface provides a single Resolve method, which will return from cache or call the provided resolve function to get the value if not available in cache
func GetResolver ¶
GetResolver returns a cache resolver for persistent cached data across Syft runs, stored in a unique location based on the provided name and versioned by the type
func GetResolverCachingErrors ¶
GetResolverCachingErrors returns a Resolver that caches errors and will return them instead of continuing to call the provided resolve functions