Skip to content

Commit

Permalink
freelru: Fix impl
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 9, 2024
1 parent fcb1964 commit 11ffb96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contrab/freelru/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ func (lru *LRU[K, V]) add(hash uint32, key K, value V) (evicted bool) {
// If the found cache item is already expired, the evict function is called
// and the return value indicates that the key was not found.
func (lru *LRU[K, V]) Get(key K) (value V, ok bool) {
return lru.get(lru.hash(key), key, true)
return lru.get(lru.hash(key), key)
}

func (lru *LRU[K, V]) get(hash uint32, key K, updateLifetime bool) (value V, ok bool) {
if pos, ok := lru.findKey(hash, key, updateLifetime); ok {
func (lru *LRU[K, V]) get(hash uint32, key K) (value V, ok bool) {
if pos, ok := lru.findKey(hash, key, true); ok {
if pos != lru.head {
lru.unlinkElement(pos)
lru.setHead(pos)
Expand Down

0 comments on commit 11ffb96

Please sign in to comment.