Skip to content

fangker/go-linkedHashMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GO LinkedHashMap

LinkedHashMap supports dynamically capacity increasing.It's It's very simple to build an least recently used cache.

install

go get github.com/fangker/go-linkedHashMap

Usage

import

import "github.com/fangker/go-linkedHashMap"

Create a linkedHashMap

lhm := NewLinkedHashMap()

Initialize the LHM

lhm.Init(<int> initialCapacity, <bool> useLRU)

The initial capacity parameter can suggest the length of hash arry

Put Hash data

lhm.Put(<int> key, <interface> data)

Get Hash data

lhm.Get(<int> key, <interface> data)

Get Hash data

lhm.Get(<int> key, <interface> data)

Get Base item

lhm.Base()

implement LRU Algorithm

You can override "RecordAccess" function to implement LRU Algorithm. The default "RecordAccess" method "MoveTo" will be invoked.

Releases

Packages

Used by

Contributors

Languages