ForgetPath clears the cache for itself and all subdirectories if they match the given path. The path is specified relative from the directory it is called from. The cache of the parent directory is marked as stale, but not cleared otherwise. It is not possible to traverse the directory tree upwards,
(relativePath string, entryType fs.EntryType)
| 305 | // It is not possible to traverse the directory tree upwards, i.e. |
| 306 | // you cannot clear the cache for the Dir's ancestors or siblings. |
| 307 | func (d *Dir) ForgetPath(relativePath string, entryType fs.EntryType) { |
| 308 | defer log.Trace(d.path, "relativePath=%q, type=%v", relativePath, entryType)("") |
| 309 | d.mu.RLock() |
| 310 | absPath := path.Join(d.path, relativePath) |
| 311 | d.mu.RUnlock() |
| 312 | if absPath != "" { |
| 313 | d.invalidateDir(vfscommon.FindParent(absPath)) |
| 314 | } |
| 315 | if entryType == fs.EntryDirectory { |
| 316 | d.forgetDirPath(relativePath) |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | // walk runs a function on all cached directories. It will be called |
| 321 | // on a directory's children first. |