Skip to content
A simple thread-safe LRU cache, written in go
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
lru-cache.go

README.md

Least Recently Used cache, written in Go

A simple thread-safe LRU cache, written in go. The cache's cap is based on the number of bytes stored within it, as opposed to the number of items.

go get -u github.com/nsmithuk/lru-cache-go

Create a new cache

cache := lrucache.New( <max size in bytes> )

Adding an item

err := cache.Set(key, value, <value size in bytes>)

If the key already exists it will be overwritten with the new value.

Getting an item

value, found := cache.Get(key)

Removing an item

cache.Delete(key)

License

This project is released under the MIT license, a copy of which can be found in LICENSE.

You can’t perform that action at this time.