MCPcopy Create free account
hub / github.com/patrickmn/go-cache / Delete

Method Delete

cache.go:905–912  ·  view source on GitHub ↗

Delete an item from the cache. Does nothing if the key is not in the cache.

(k string)

Source from the content-addressed store, hash-verified

903
904// Delete an item from the cache. Does nothing if the key is not in the cache.
905func (c *cache) Delete(k string) {
906 c.mu.Lock()
907 v, evicted := c.delete(k)
908 c.mu.Unlock()
909 if evicted {
910 c.onEvicted(k, v)
911 }
912}
913
914func (c *cache) delete(k string) (interface{}, bool) {
915 if c.onEvicted != nil {

Callers 3

TestDeleteFunction · 0.45
TestOnEvictedFunction · 0.45
BenchmarkCacheSetDeleteFunction · 0.45

Calls 1

deleteMethod · 0.95

Tested by 3

TestDeleteFunction · 0.36
TestOnEvictedFunction · 0.36
BenchmarkCacheSetDeleteFunction · 0.36