fix(lru): add key update length
This commit is contained in:
parent
19e1bb59a3
commit
7ac9651ef3
|
@ -123,6 +123,9 @@ func (lru *SingleCache) Add(key *proto.BaseKey, val structure.KeyBaseInterface)
|
||||||
}
|
}
|
||||||
if elVal, ok := lru.lruMap[key.Key]; ok {
|
if elVal, ok := lru.lruMap[key.Key]; ok {
|
||||||
lru.li.MoveToFront(elVal)
|
lru.li.MoveToFront(elVal)
|
||||||
|
oldSize := elVal.Value.(structure.KeyBaseInterface).SizeByte()
|
||||||
|
|
||||||
|
lru.UpdateLruSize(structure.UpdateLength(val.SizeByte() - oldSize))
|
||||||
elVal.Value = keyBaseVal
|
elVal.Value = keyBaseVal
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue