cache: purge file data on notification

This commit is contained in:
remusb 2018-04-03 22:46:00 +03:00
parent 06a8d3011d
commit 1dea99ab20
3 changed files with 16 additions and 10 deletions

View file

@ -400,6 +400,16 @@ func (b *Persistent) RemoveObject(fp string) error {
})
}
// ExpireObject will flush an Object and all its data if desired
func (b *Persistent) ExpireObject(co *Object, withData bool) error {
co.CacheTs = time.Now().Add(co.CacheFs.fileAge * -1)
err := b.AddObject(co)
if withData {
_ = os.RemoveAll(path.Join(b.dataPath, co.abs()))
}
return err
}
// HasEntry confirms the existence of a single entry (dir or object)
func (b *Persistent) HasEntry(remote string) bool {
dir, name := path.Split(remote)