Stat tests whether the backend has a file. If it does not exist but still exists in the cache, it is removed from the cache.
(ctx context.Context, h backend.Handle)
| 199 | // Stat tests whether the backend has a file. If it does not exist but still |
| 200 | // exists in the cache, it is removed from the cache. |
| 201 | func (b *Backend) Stat(ctx context.Context, h backend.Handle) (backend.FileInfo, error) { |
| 202 | debug.Log("cache Stat(%v)", h) |
| 203 | |
| 204 | fi, err := b.Backend.Stat(ctx, h) |
| 205 | if err != nil && b.Backend.IsNotExist(err) { |
| 206 | // try to remove from the cache, ignore errors |
| 207 | _, _ = b.Cache.remove(h) |
| 208 | } |
| 209 | |
| 210 | return fi, err |
| 211 | } |
| 212 | |
| 213 | // IsNotExist returns true if the error is caused by a non-existing file. |
| 214 | func (b *Backend) IsNotExist(err error) bool { |
nothing calls this directly
no test coverage detected