INNER CODE UNIT · Go
func
kubernetes-csi/csi-driver-nfs · pkg/nfs/cache.go:96
func (t *TimedCache) getInternal(key string) (*CacheEntry, error) {
entry, exists, err := t.Store.GetByKey(key)
if err != nil {
return nil, err
}
// if entry exists, return the entry
if exists {
return entry.(*CacheEntry), nil
}
// lock here to ensure if entry doesn't exist, we add a new entry
// avoiding overwrites
t.MutexLock.Lock()
defer t.MutexLock.Unlock()
// Another goroutine might have written the same key.
entry, exists, err = t.Store.GetByKey(key)
if err != nil {