diff --git a/pkg/bindinfo/binding_cache.go b/pkg/bindinfo/binding_cache.go index 341d1c0e22aee..39216d34629e7 100644 --- a/pkg/bindinfo/binding_cache.go +++ b/pkg/bindinfo/binding_cache.go @@ -224,6 +224,9 @@ func (c *bindingCache) get(key bindingCacheKey) Bindings { if !hit { return nil } + if value == nil { + return nil + } typedValue := value.(Bindings) return typedValue } @@ -249,6 +252,7 @@ func (c *bindingCache) set(key bindingCacheKey, value Bindings) (ok bool, err er return } c.memTracker.Consume(-calcBindCacheKVMem(evictedKey.(bindingCacheKey), evictedValue.(Bindings))) + c.cache.Put(evictedKey, nil) } c.memTracker.Consume(mem) c.cache.Put(key, value)