ClearMappingsPrefix deletes all mappings to parents with given prefix Returns number of entries deleted
(prefix string)
| 261 | // |
| 262 | // Returns number of entries deleted |
| 263 | func ClearMappingsPrefix(prefix string) (deleted int) { |
| 264 | mu.Lock() |
| 265 | do := func(mapping map[string]string) { |
| 266 | for key, val := range mapping { |
| 267 | if !strings.HasPrefix(val, prefix) { |
| 268 | continue |
| 269 | } |
| 270 | delete(mapping, key) |
| 271 | deleted++ |
| 272 | } |
| 273 | } |
| 274 | do(remap) |
| 275 | do(childParentMap) |
| 276 | mu.Unlock() |
| 277 | return deleted |
| 278 | } |
| 279 | |
| 280 | // EntriesWithPinCount returns the number of pinned and unpinned entries in the cache |
| 281 | // |
no test coverage detected
searching dependent graphs…