[fixedmap] make fixedmap a LRU cache

Signed-off-by: eater <=@eater.me>
master
eater 4 years ago
parent 61554f10b4
commit ae00a36d83
No known key found for this signature in database
GPG Key ID: AD2560A0F84F0759

@ -38,6 +38,8 @@ func NewFixedMap(size int) *FixedMap {
func (fm *FixedMap) Get(key string) *File {
elem, ok := fm.Map[key]
if ok {
/* And that's an LRU implementation folks! */
fm.List.MoveToFront(elem.Element)
return elem.Value
} else {
return nil

Loading…
Cancel
Save