Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found in cache")
ErrNotFound is returned when a result isn't found in the cache
Functions ¶
Types ¶
type Cache ¶
type Cache interface { // GetResult retrieves a scorecard result from the cache GetResult(ctx context.Context, repository string) (*models.ScorecardResult, error) // PutResult inserts a score into the cache PutResult(ctx context.Context, repository string, result *models.ScorecardResult) error }
Cache caches results
type Option ¶
type Option func(o *options)
Option is a functional option that configures a cache
func WithDuration ¶
WithDuration is a functional option that configures the amount of time until an item in the cache is invalidated
type ScorecardClient ¶
ScorecardClient wraps another scorecard client, caching the scores it retrieves
func (*ScorecardClient) GetResult ¶
func (c *ScorecardClient) GetResult(ctx context.Context, repository string) (*models.ScorecardResult, error)
GetResult attempts to get the scorecard result from the cache. Failing that it will get the scorecard result from the wrapped client and cache it for next time.
Click to show internal directories.
Click to hide internal directories.