Golang LRU cache
Switch branches/tags
Nothing to show
Clone or download
Latest commit 20f1fb7 Aug 30, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
simplelru fmt Aug 30, 2018
.gitignore Initial commit Aug 6, 2014
2q.go Fixing conflicts Feb 1, 2018
2q_test.go Implement 2Q cache replacement Nov 28, 2015
LICENSE Initial commit Aug 6, 2014
README.md fmt.Sprintf inside panic call Jan 19, 2015
arc.go Fixing conflicts Feb 1, 2018
arc_test.go Adding basic benchmarks Nov 20, 2015
doc.go Fix up the documentation Jan 17, 2016
go.mod Add go.mod Aug 30, 2018
lru.go Fixing conflicts Feb 1, 2018
lru_test.go remove some golint warnings Jan 28, 2018

README.md

golang-lru

This provides the lru package which implements a fixed-size thread safe LRU cache. It is based on the cache in Groupcache.

Documentation

Full docs are available on Godoc

Example

Using the LRU is very simple:

l, _ := New(128)
for i := 0; i < 256; i++ {
    l.Add(i, nil)
}
if l.Len() != 128 {
    panic(fmt.Sprintf("bad len: %v", l.Len()))
}