Fix lru cache Get returning opposite
This commit is contained in:
parent
6a7cb676aa
commit
9dbb3394b8
|
@ -29,7 +29,7 @@ func NewLRUCache[K comparable, T any](size int) *LRUCache[K, T] {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LRUCache[K, T]) Get(key K) (value T, ok bool) {
|
func (c *LRUCache[K, T]) Get(key K) (value T, ok bool) {
|
||||||
if value, ok = c.values.Load().Get(key); !ok {
|
if value, ok = c.values.Load().Get(key); ok {
|
||||||
c.hits.Add(1)
|
c.hits.Add(1)
|
||||||
return value, true
|
return value, true
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue