func NewPersistentClient(path string, TTL time.Duration) (*http.Client, error) {
	if _, err := os.Stat(path); os.IsNotExist(err) {
		if err := os.Mkdir(path, os.ModeDir|os.ModePerm); err != nil {
			return nil, fmt.Errorf("httpcache: could not create dir %s: %v", path, err)
		}
	}
	return &http.Client{Transport: NewPersistent(http.DefaultTransport, path, TTL)}, nil
}
NewPersistentClient creates an http client with a file cache.
package httpcache
import (
	"fmt"
	"net/http"
	"os"
	"time"
)
func NewPersistent(transport http.RoundTripper, path string, TTL time.Duration) http.RoundTripper {
	return &CachedRoundTrip{
		Transport: transport,
		Cache:     &fileCache{Path: path},
		TTL:       TTL,
	}
}