commit | 3128ce6ec1a5d96c43aa774087ec574fce0e4ac7 | [log] [tgz] |
---|---|---|
author | Googler <noreply@google.com> | Thu Apr 28 20:51:21 2022 +0000 |
committer | brettmeehan <brettmeehan@google.com> | Thu Apr 28 21:00:27 2022 +0000 |
tree | 4c22db2cdc2b605c7b58faf3fa43e18808b0c30c |
Internal change PiperOrigin-RevId: 445239910 Change-Id: I1887fad7cf9438e9937752397513a28c42e6d0f5
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()))
}