func()

in secretcache/lruCache.go [67:90]


func (l *lruCache) putIfAbsent(key string, data interface{}) bool {
	l.mux.Lock()
	defer l.mux.Unlock()

	_, found := l.cacheMap[key]

	if found {
		return false
	}

	item := &lruItem{key: key, data: data}
	l.cacheMap[key] = item

	l.cacheSize++
	l.updateHead(item)

	if l.cacheSize > l.cacheMaxSize {
		delete(l.cacheMap, (*l.tail).key)
		l.unlink(l.tail)
		l.cacheSize--
	}

	return true
}