update spf13/cobra dependency to 1.0.0
This commit is contained in:
14
vendor/github.com/golang/groupcache/lru/lru.go
generated
vendored
14
vendor/github.com/golang/groupcache/lru/lru.go
generated
vendored
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user