Files
external-snapshotter/vendor/github.com/hashicorp/golang-lru
Patrick Ohly 211f83fe15 replace "dep" with "go mod"
A simple "go mod init && go mod tidy && go mod vendor" was enough and
mostly seems to have picked the same revisions of the dependencies as
before. Notable exceptions are klog and gogo/protobuf.
2019-10-28 12:46:41 +01:00
..
2019-10-28 12:46:41 +01:00
2018-08-10 06:20:40 -07:00
2018-08-10 06:20:40 -07:00
2018-08-10 06:20:40 -07:00
2019-10-28 12:46:41 +01:00
2018-08-10 06:20:40 -07:00
2019-10-28 12:46:41 +01: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()))
}