...

Source file src/github.com/redhat-developer/odo/pkg/util/httpcache.go

Documentation: github.com/redhat-developer/odo/pkg/util

     1  package util
     2  
     3  import (
     4  	"path/filepath"
     5  
     6  	"github.com/devfile/library/v2/pkg/testingutil/filesystem"
     7  	"k8s.io/klog"
     8  )
     9  
    10  // CleanDefaultHTTPCacheDir cleans the default directory used for HTTP caching
    11  func CleanDefaultHTTPCacheDir() error {
    12  	return cleanDefaultHTTPCacheDir(filesystem.DefaultFs{})
    13  }
    14  
    15  func cleanDefaultHTTPCacheDir(fs filesystem.Filesystem) error {
    16  	cacheFiles, err := fs.ReadDir(httpCacheDir)
    17  	if err != nil {
    18  		return err
    19  	}
    20  
    21  	for _, f := range cacheFiles {
    22  		klog.V(4).Infof("Removing cache file %s", f.Name())
    23  		err := fs.Remove(filepath.Join(httpCacheDir, f.Name()))
    24  		if err != nil {
    25  			return err
    26  		}
    27  	}
    28  	return nil
    29  }
    30  

View as plain text