MCPcopy Index your code
hub / github.com/patrickmn/go-cache / LoadFile

Method LoadFile

cache.go:1024–1035  ·  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

1022// NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the
1023// documentation for NewFrom().)
1024func (c *cache) LoadFile(fname string) error {
1025 fp, err := os.Open(fname)
1026 if err != nil {
1027 return err
1028 }
1029 err = c.Load(fp)
1030 if err != nil {
1031 fp.Close()
1032 return err
1033 }
1034 return fp.Close()
1035}
1036
1037// Copies all unexpired items in the cache into a new map and returns it.
1038func (c *cache) Items() map[string]Item {

Callers 1

TestFileSerializationFunction · 0.80

Calls 1

LoadMethod · 0.95

Tested by 1

TestFileSerializationFunction · 0.64