1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-16 00:00:05 +01:00

Update files in the cache on save

This commit is contained in:
Alexander Neumann 2016-09-04 22:34:14 +02:00
parent 16715ed86f
commit 10fb5c8f3f

View file

@ -322,7 +322,17 @@ func (r *Repository) SaveUnpacked(t restic.FileType, p []byte) (id restic.ID, er
return restic.ID{}, err
}
debug.Log("Repo.SaveJSONUnpacked", "blob %v saved", h)
// store file in the cache
if r.cache != nil && (t == restic.IndexFile || t == restic.SnapshotFile) {
h := restic.Handle{Name: id.String(), Type: t}
err := r.cache.PutFile(h, p)
if err != nil {
return restic.ID{}, err
}
debug.Log("Repo.Save", "updated file %v in cache", h)
}
debug.Log("Repo.SaveJSONUnpacked", "file %v saved", h)
return id, nil
}