mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-01 07:20:59 +00:00
c-go cache: Use diskv TempDir to get atomic write
Kubernetes-commit: e58da7bb7c1800ffd4f24cf77c2e3f3cdfcdf906
This commit is contained in:
parent
1429110930
commit
0b7513368a
@ -19,6 +19,7 @@ package transport
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -97,7 +98,10 @@ type authProxyRoundTripper struct {
|
||||
// response headers and send the If-None-Match header on subsequent
|
||||
// corresponding requests.
|
||||
func NewCacheRoundTripper(cacheDir string, rt http.RoundTripper) http.RoundTripper {
|
||||
d := diskv.New(diskv.Options{BasePath: cacheDir})
|
||||
d := diskv.New(diskv.Options{
|
||||
BasePath: cacheDir,
|
||||
TempDir: filepath.Join(cacheDir, ".diskv-temp"),
|
||||
})
|
||||
t := httpcache.NewTransport(diskcache.NewWithDiskv(d))
|
||||
t.Transport = rt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user