github.com/anchore/syft@v1.38.2/internal/cache/bypass.go (about)

     1  package cache
     2  
     3  import "io"
     4  
     5  type bypassedCache struct{}
     6  
     7  func (b *bypassedCache) Read(_ string) (ReaderAtCloser, error) {
     8  	return nil, errNotFound
     9  }
    10  
    11  func (b *bypassedCache) Write(_ string, contents io.Reader) error {
    12  	if closer, ok := contents.(io.Closer); ok {
    13  		_ = closer.Close()
    14  	}
    15  	return nil
    16  }
    17  
    18  func (b *bypassedCache) GetCache(_, _ string) Cache {
    19  	return b
    20  }
    21  
    22  func (b *bypassedCache) RootDirs() []string {
    23  	return nil
    24  }