MCPcopy
hub / github.com/rclone/rclone / DeletePrefix

Method DeletePrefix

lib/cache/cache.go:177–189  ·  view source on GitHub ↗

DeletePrefix deletes all entries with the given prefix Returns number of entries deleted

(prefix string)

Source from the content-addressed store, hash-verified

175//
176// Returns number of entries deleted
177func (c *Cache) DeletePrefix(prefix string) (deleted int) {
178 c.mu.Lock()
179 for key, entry := range c.cache {
180 if !strings.HasPrefix(key, prefix) {
181 continue
182 }
183 c.finalize(entry.value)
184 delete(c.cache, key)
185 deleted++
186 }
187 c.mu.Unlock()
188 return deleted
189}
190
191// Rename renames the item at oldKey to newKey.
192//

Callers 3

TestDeletePrefixFunction · 0.80
TestCacheFinalizeFunction · 0.80
ClearConfigFunction · 0.80

Calls 3

finalizeMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by 2

TestDeletePrefixFunction · 0.64
TestCacheFinalizeFunction · 0.64