MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / SaveFile

Method SaveFile

pkg/util/cache/cache.go:1002–1013  ·  view source on GitHub ↗

Save the cache's items to the given filename, creating the file if it doesn't exist, and overwriting it if it does. NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the documentation for NewFrom().)

(fname string)

Source from the content-addressed store, hash-verified

1000// NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the
1001// documentation for NewFrom().)
1002func (c *cache) SaveFile(fname string) error {
1003 fp, err := os.Create(fname)
1004 if err != nil {
1005 return err
1006 }
1007 err = c.Save(fp)
1008 if err != nil {
1009 fp.Close()
1010 return err
1011 }
1012 return fp.Close()
1013}
1014
1015// Add (Gob-serialized) cache items from an io.Reader, excluding any items with
1016// keys that already exist (and haven't expired) in the current cache.

Callers 1

TestFileSerializationFunction · 0.80

Calls 3

SaveMethod · 0.95
CreateMethod · 0.65
CloseMethod · 0.65

Tested by 1

TestFileSerializationFunction · 0.64