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