syft/internal/cache/memory.go
Keith Zantow af3aaa0397
fix: make caching options more explicit (#2966)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
2024-06-14 18:45:48 +00:00

19 lines
289 B
Go

package cache
import (
"time"
"github.com/spf13/afero"
)
// NewInMemory returns an in-memory only cache manager
func NewInMemory(ttl time.Duration) Manager {
if ttl <= 0 {
return &bypassedCache{}
}
return &filesystemCache{
dir: "",
fs: afero.NewMemMapFs(),
ttl: ttl,
}
}