MCPcopy Index your code
hub / github.com/docker/docker-agent / writeCache

Function writeCache

pkg/modelsdev/store_test.go:19–24  ·  view source on GitHub ↗

writeCache writes a fresh on-disk catalog cache the Store can load without touching the network.

(tb testing.TB, path string, db Database)

Source from the content-addressed store, hash-verified

17// writeCache writes a fresh on-disk catalog cache the Store can load without
18// touching the network.
19func writeCache(tb testing.TB, path string, db Database) {
20 tb.Helper()
21 data, err := json.Marshal(CachedData{Database: db, LastRefresh: time.Now()})
22 require.NoError(tb, err)
23 require.NoError(tb, os.WriteFile(path, data, 0o600))
24}
25
26// expiredContext returns a context whose deadline is already in the past, so
27// any HTTP request built from it fails instantly without touching the network.

Calls 1

NowMethod · 0.80

Tested by

no test coverage detected