From b04157fafeadaf0538114521172285d8d24e739a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 14 May 2025 11:51:58 +0200 Subject: [PATCH] common/lru: shorten return names --- common/lru/basiclru.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/lru/basiclru.go b/common/lru/basiclru.go index 8382dbac95..154831a796 100644 --- a/common/lru/basiclru.go +++ b/common/lru/basiclru.go @@ -52,32 +52,32 @@ func (c *BasicLRU[K, V]) Add(key K, value V) (evicted bool) { } // Add3 adds a value to the cache. If an item was evicted to store the new one, it returns the evicted item. -func (c *BasicLRU[K, V]) Add3(key K, value V) (evKey K, evItem V, evicted bool) { +func (c *BasicLRU[K, V]) Add3(key K, value V) (ek K, ev V, evicted bool) { item, ok := c.items[key] if ok { item.value = value c.items[key] = item c.list.moveToFront(item.elem) - return evKey, evItem, false + return ek, ev, false } var elem *listElem[K] if c.Len() >= c.cap { elem = c.list.removeLast() evicted = true - evKey = elem.v - evItem = c.items[evKey].value - delete(c.items, evKey) + ek = elem.v + ev = c.items[ek].value + delete(c.items, ek) } else { elem = new(listElem[K]) } // Store the new item. - // Note that, if another item was evicted, we re-use its list element here. + // Note that if another item was evicted, we re-use its list element here. elem.v = key c.items[key] = cacheItem[K, V]{elem, value} c.list.pushElem(elem) - return evKey, evItem, evicted + return ek, ev, evicted } // Contains reports whether the given key exists in the cache.