Skip to content

Simple thread-safe generic Go LRU cache implementation

License

Notifications You must be signed in to change notification settings

notEpsilon/go-lru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-lru

Simple thread-safe generic Go LRU cache implementation

Installation

go get github.com/notEpsilon/go-lru

Usage

using the cache is very simple

cache := lru.New[int, string](2) // give capacity

cache.Put(1, "fish")

value, err := cache.Get(1) // returns an error if the key wasn't found
if err != nil {
  panic(err)
}

fmt.Println(value) // fish

About

Simple thread-safe generic Go LRU cache implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages