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)
| 982 | // NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the |
| 983 | // documentation for NewFrom().) |
| 984 | func (c *cache) SaveFile(fname string) error { |
| 985 | fp, err := os.Create(fname) |
| 986 | if err != nil { |
| 987 | return err |
| 988 | } |
| 989 | err = c.Save(fp) |
| 990 | if err != nil { |
| 991 | fp.Close() |
| 992 | return err |
| 993 | } |
| 994 | return fp.Close() |
| 995 | } |
| 996 | |
| 997 | // Add (Gob-serialized) cache items from an io.Reader, excluding any items with |
| 998 | // keys that already exist (and haven't expired) in the current cache. |