1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 13:29:11 +01:00

go mod tidy && go mod vendor

This commit is contained in:
Mike Dame
2020-07-27 13:55:29 -04:00
parent 63603f38d6
commit b09932e92a
995 changed files with 112809 additions and 126725 deletions

View File

@@ -25,7 +25,7 @@ type Cache struct {
// an item is evicted. Zero means no limit.
MaxEntries int
// OnEvicted optionally specificies a callback function to be
// OnEvicted optionally specifies a callback function to be
// executed when an entry is purged from the cache.
OnEvicted func(key Key, value interface{})
@@ -119,3 +119,15 @@ func (c *Cache) Len() int {
}
return c.ll.Len()
}
// Clear purges all stored items from the cache.
func (c *Cache) Clear() {
if c.OnEvicted != nil {
for _, e := range c.cache {
kv := e.Value.(*entry)
c.OnEvicted(kv.key, kv.value)
}
}
c.ll = nil
c.cache = nil
}