MCPcopy Create free account
hub / github.com/cloudwan/gohan / getCachedSchemas

Method getCachedSchemas

cli/client/cache.go:33–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func (gohanClientCLI *GohanClientCLI) getCachedSchemas() ([]*schema.Schema, error) {
34 rawCache, err := ioutil.ReadFile(gohanClientCLI.opts.cachePath)
35 if err != nil {
36 return gohanClientCLI.getSchemas()
37 }
38 cache := Cache{}
39 err = json.Unmarshal(rawCache, &cache)
40 if err != nil {
41 return gohanClientCLI.getSchemas()
42 }
43 if time.Now().After(cache.Expire) {
44 return gohanClientCLI.getSchemas()
45 }
46 return cache.Schemas, nil
47}
48
49func (gohanClientCLI *GohanClientCLI) setCachedSchemas() error {
50 cache := Cache{

Callers 2

NewGohanClientCLIFunction · 0.95
client_test.goFile · 0.80

Calls 1

getSchemasMethod · 0.95

Tested by

no test coverage detected