prysm-pulse/vendor/github.com/hashicorp/golang-lru
Preston Van Loon a41e372b39 First pass collation
Former-commit-id: fa0dc873367b92a06b10fd989e3fec960c03065a [formerly e98efffa565ea6aa3eadeb19c2f9a66a56eb5ddd]
Former-commit-id: ce6e4f01d12015e67a51aa7d928a6ab8e8eedeee
2018-01-12 22:59:17 -05:00
..
simplelru First pass collation 2018-01-12 22:59:17 -05:00
2q.go First pass collation 2018-01-12 22:59:17 -05:00
arc.go First pass collation 2018-01-12 22:59:17 -05:00
LICENSE First pass collation 2018-01-12 22:59:17 -05:00
lru.go First pass collation 2018-01-12 22:59:17 -05:00
README.md First pass collation 2018-01-12 22:59:17 -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()))
}