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)
| 1022 | // NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the |
| 1023 | // documentation for NewFrom().) |
| 1024 | func (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. |
| 1038 | func (c *cache) Items() map[string]Item { |