Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/golang-lru
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.1
Choose a base ref
...
head repository: hashicorp/golang-lru
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.2
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 8, 2023

  1. Update README for v1.0.2

    mgaffney committed Aug 8, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    mgaffney Michael Gaffney
    Copy the full SHA
    a032ef5 View commit details
Showing with 4 additions and 22 deletions.
  1. +4 −22 README.md
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
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](https://pkg.go.dev/github.com/hashicorp/golang-lru)

Example
=======

Using the LRU is very simple:

```go
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()))
}
```
Please upgrade to github.com/hashicorp/golang-lru/v2 for all new code as v1 will
not be updated anymore. The v2 version supports generics and is faster; old code
can specify a specific tag, e.g. github.com/hashicorp/golang-lru/v1.0.2 for
backwards compatibility.