commit | 8645ce8105795cd2e9f511b22a6c6db8429c615d | [log] [tgz] |
---|---|---|
author | Googler <noreply@google.com> | Mon Oct 10 01:59:33 2022 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Mon Oct 10 02:00:04 2022 -0700 |
tree | 8d61cd8181311f35992ba4173bc14d825dc2cfcc | |
parent | 3128ce6ec1a5d96c43aa774087ec574fce0e4ac7 [diff] |
Internal change PiperOrigin-RevId: 480024818 Change-Id: Ie636dbde41c86723fbb17a587e4412b0d8dcca43
This provides the lru
package which implements a fixed-size thread safe LRU cache. It is based on the cache in Groupcache.
Full docs are available on Godoc
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()))
}