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

Method LoadFile

pkg/util/cache/cache.go:1042–1053  ·  view source on GitHub ↗

Load and add cache items from the given filename, excluding any items with keys that already exist in the current cache. 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

1040// NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the
1041// documentation for NewFrom().)
1042func (c *cache) LoadFile(fname string) error {
1043 fp, err := os.Open(fname)
1044 if err != nil {
1045 return err
1046 }
1047 err = c.Load(fp)
1048 if err != nil {
1049 fp.Close()
1050 return err
1051 }
1052 return fp.Close()
1053}
1054
1055// Copies all unexpired items in the cache into a new map and returns it.
1056func (c *cache) Items() map[string]Item {

Callers 1

TestFileSerializationFunction · 0.80

Calls 2

LoadMethod · 0.95
CloseMethod · 0.65

Tested by 1

TestFileSerializationFunction · 0.64