mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-08-19 04:06:27 +00:00
Remove deleted files from cache instead of clearing the whole cache
This commit is contained in:
@@ -94,13 +94,16 @@ func (w *Watcher) updateCache() error {
|
||||
}
|
||||
}
|
||||
|
||||
// clear cache
|
||||
// remove deleted files from cache
|
||||
w.Cache.Range(func(key interface{}, value interface{}) bool {
|
||||
w.Cache.Delete(key)
|
||||
_, ok := fileMap[key.(string)]
|
||||
if !ok {
|
||||
w.Cache.Delete(key)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
// load cache
|
||||
// sync cache
|
||||
for k, v := range fileMap {
|
||||
w.Cache.Store(k, v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user