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)
| 1000 | // NOTE: This method is deprecated in favor of c.Items() and NewFrom() (see the |
| 1001 | // documentation for NewFrom().) |
| 1002 | func (c *cache) SaveFile(fname string) error { |
| 1003 | fp, err := os.Create(fname) |
| 1004 | if err != nil { |
| 1005 | return err |
| 1006 | } |
| 1007 | err = c.Save(fp) |
| 1008 | if err != nil { |
| 1009 | fp.Close() |
| 1010 | return err |
| 1011 | } |
| 1012 | return fp.Close() |
| 1013 | } |
| 1014 | |
| 1015 | // Add (Gob-serialized) cache items from an io.Reader, excluding any items with |
| 1016 | // keys that already exist (and haven't expired) in the current cache. |