Clone this repo:

Branches

  1. d199904 No public description by Googler · 1 year, 3 months ago master
  2. 8645ce8 Internal change by Googler · 2 years, 1 month ago
  3. 3128ce6 Internal change by Googler · 2 years, 7 months ago

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