Browse Source
Merge pull request #686 from qszxnp/filer2_dir_cache_bugfix
bugfix:delete Directory cache when filer2 delete Directory
pull/610/merge
Chris Lu
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
0 deletions
-
weed/filer2/filer.go
|
|
@ -139,6 +139,7 @@ func (f *Filer) DeleteEntryMetaAndData(p FullPath, shouldDeleteChunks bool) (err |
|
|
|
if len(entries) > 0 { |
|
|
|
return fmt.Errorf("folder %s is not empty", p) |
|
|
|
} |
|
|
|
f.cacheDelDirectory(string(p)) |
|
|
|
} |
|
|
|
|
|
|
|
if shouldDeleteChunks { |
|
|
@ -155,6 +156,14 @@ func (f *Filer) ListDirectoryEntries(p FullPath, startFileName string, inclusive |
|
|
|
return f.store.ListDirectoryEntries(p, startFileName, inclusive, limit) |
|
|
|
} |
|
|
|
|
|
|
|
func (f *Filer) cacheDelDirectory(dirpath string) { |
|
|
|
if f.directoryCache == nil { |
|
|
|
return |
|
|
|
} |
|
|
|
f.directoryCache.Delete(dirpath) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func (f *Filer) cacheGetDirectory(dirpath string) *Entry { |
|
|
|
if f.directoryCache == nil { |
|
|
|
return nil |
|
|
|