func (c *cache) removeEpFromCache(name, namespace string) {
	c.Lock()
	defer c.Unlock()
	if _, ok := c.epCache[types.NamespacedName{Name: name, Namespace: namespace}]; ok {
		delete(c.epCache, types.NamespacedName{Name: name, Namespace: namespace})
	} else {
		klog.Warningf("endpoint %s/%s not found in the cache", namespace, name)
	}
}
removeEpFromCache removes stored service from cache.
package proxy
import (
	"fmt"
	"sync"
	v1 "k8s.io/api/core/v1"
	discovery "k8s.io/api/discovery/v1beta1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/klog"
)
type cache struct {
	sync.Mutex
	svcCache  map[types.NamespacedName]*v1.Service
	epCache   map[types.NamespacedName]*v1.Endpoints
	epslCache map[types.NamespacedName]*discovery.EndpointSlice
}
func (c *cache) getCachedSvcVersion(name, namespace string) (string, error) {
	c.Lock()
	defer c.Unlock()
	s, ok := c.svcCache[types.NamespacedName{Name: name, Namespace: namespace}]
	if !ok {
		return "", fmt.Errorf("service %s/%s not found in the cache", namespace, name)
	}
	return s.ObjectMeta.GetResourceVersion(), nil
}
func (c *cache) getLastKnownSvcFromCache(name, namespace string) (*v1.Service, error) {
	c.Lock()
	defer c.Unlock()
	s, ok := c.svcCache[types.NamespacedName{Name: name, Namespace: namespace}]
	if !ok {
		return nil, fmt.Errorf("service %s/%s not found in the cache", namespace, name)
	}
	return s, nil
}
func (c *cache) storeSvcInCache(s *v1.Service) {
	c.Lock()
	defer c.Unlock()
	c.svcCache[types.NamespacedName{Name: s.ObjectMeta.Name, Namespace: s.ObjectMeta.Namespace}] = s.DeepCopy()
}
func (c *cache) removeSvcFromCache(name, namespace string) {
	c.Lock()
	defer c.Unlock()
	if _, ok := c.svcCache[types.NamespacedName{Name: name, Namespace: namespace}]; ok {
		delete(c.svcCache, types.NamespacedName{Name: name, Namespace: namespace})
	} else {
		klog.Warningf("service %s/%s not found in the cache", namespace, name)
	}
}
func (c *cache) getCachedEpVersion(name, namespace string) (string, error) {
	c.Lock()
	defer c.Unlock()
	ep, ok := c.epCache[types.NamespacedName{Name: name, Namespace: namespace}]
	if !ok {
		return "", fmt.Errorf("endpoint %s/%s not found in the cache", namespace, name)
	}
	return ep.ObjectMeta.GetResourceVersion(), nil
}
func (c *cache) getLastKnownEpFromCache(name, namespace string) (*v1.Endpoints, error) {
	c.Lock()
	defer c.Unlock()
	ep, ok := c.epCache[types.NamespacedName{Name: name, Namespace: namespace}]
	if !ok {
		return nil, fmt.Errorf("endpoint %s/%s not found in the cache", namespace, name)
	}
	return ep, nil
}
func (c *cache) storeEpInCache(ep *v1.Endpoints) {
	c.Lock()
	defer c.Unlock()
	c.epCache[types.NamespacedName{Name: ep.ObjectMeta.Name, Namespace: ep.ObjectMeta.Namespace}] = ep.DeepCopy()
}