clair/vendor/github.com/hashicorp/golang-lru
2016-06-07 10:08:50 +02:00
..
simplelru replace GoDep by Glide 2016-06-07 10:08:50 +02:00
.gitignore *: refresh godeps 2016-02-24 16:34:54 -05:00
2q_test.go replace GoDep by Glide 2016-06-07 10:08:50 +02:00
2q.go *: refresh godeps 2016-02-24 16:34:54 -05:00
arc_test.go replace GoDep by Glide 2016-06-07 10:08:50 +02:00
arc.go *: refresh godeps 2016-02-24 16:34:54 -05:00
LICENSE *: refresh godeps 2016-02-24 16:34:54 -05:00
lru_test.go replace GoDep by Glide 2016-06-07 10:08:50 +02:00
lru.go *: refresh godeps 2016-02-24 16:34:54 -05:00
README.md *: refresh godeps 2016-02-24 16:34:54 -05:00

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()))
}