[fixedmap] make fixedmap a LRU cache

Signed-off-by: eater <=@eater.me>
This commit is contained in:
eater 2020-05-08 10:02:19 +02:00
parent 61554f10b4
commit ae00a36d83
No known key found for this signature in database
GPG Key ID: AD2560A0F84F0759

View File

@ -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