Merge pull request #15 from EaterLabs/feature/fixedmap/make-it-lru

[fixedmap] make fixedmap a LRU cache
master
Kim 4 years ago committed by GitHub
commit 45e77db911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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