[fixedmap] make fixedmap a LRU cache
Signed-off-by: eater <=@eater.me>
This commit is contained in:
parent
61554f10b4
commit
ae00a36d83
@ -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…
Reference in New Issue
Block a user