func (c *Cache) Create(checksum, uri string) (*os.File, error) {
	path := c.Path(checksum, uri)
	dir := filepath.Dir(path)
	err := os.MkdirAll(dir, os.ModePerm)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	return os.Create(path)
}
Create a new, empty, cache entry.
package cache
import (
	"crypto/sha256"
	"encoding/hex"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"regexp"
	"strings"
	"github.com/pkg/errors"
	"github.com/cashapp/hermit/github"
	"github.com/cashapp/hermit/ui"
	"github.com/cashapp/hermit/util"
)
type Cache struct {
	root               string
	httpClient         *http.Client
	gh                 *github.Client
	fastFailHTTPClient *http.Client
}
func BasePath(checksum, uri string) string {
	hash := util.Hash(uri, checksum)
	return filepath.Join(hash[:2], hash+"-"+filepath.Base(uri))
}
func Open(root string, ghClient *github.Client, client *http.Client, fastFailClient *http.Client) (*Cache, error) {
	err := os.MkdirAll(root, os.ModePerm)
	if err != nil {
		return nil, errors.WithStack(err)
	}
	return &Cache{
		root:               root,
		httpClient:         client,
		gh:                 ghClient,
		fastFailHTTPClient: fastFailClient,
	}, nil
}
func (c *Cache) Root() string {
	return c.root
}
func (c *Cache) Mkdir(uri string) (string, error) {
	path := c.Path("", uri)
	return path, os.MkdirAll(path, os.ModePerm)
}