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
cache := lrucache.New( <max size in bytes> )
err := cache.Set(key, value, <value size in bytes>)
If the key
already exists it will be overwritten with the new value
.
value, found := cache.Get(key)
cache.Delete(key)
This project is released under the MIT license, a copy of which can be found in LICENSE.