diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index a50085fe3..32327c0d7 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -77,3 +77,19 @@ func (c *Cache) Save(fileName string, content []byte) error { return nil } + +// Delete removes a file from the cache. +func (c *Cache) Delete(fileName string) error { + + fullPath, err := fullPath(fileName, c.ConfigDir) + if err != nil { + return fmt.Errorf("while reading cached file %s: %w", fileName, err) + } + + err = os.Remove(fullPath) + if err != nil { + return fmt.Errorf("while deleting from cache: %v", err) + } + + return nil +}