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

     1  package cache
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/spf13/afero"
     7  )
     8  
     9  // NewInMemory returns an in-memory only cache manager
    10  func NewInMemory(ttl time.Duration) Manager {
    11  	if ttl <= 0 {
    12  		return &bypassedCache{}
    13  	}
    14  	return &filesystemCache{
    15  		dir: "",
    16  		fs:  afero.NewMemMapFs(),
    17  		ttl: ttl,
    18  	}
    19  }