All Projects → dboslee → lru

dboslee / lru

Licence: other
LRU cache using go generics

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to lru

LruClockCache
A low-latency LRU approximation cache in C++ using CLOCK second-chance algorithm. Multi level cache too. Up to 2.5 billion lookups per second.
Stars: ✭ 35 (-67.59%)
Mutual labels:  lru, lru-cache
cache
LRU-based cache package for Go.
Stars: ✭ 25 (-76.85%)
Mutual labels:  lru, lru-cache
gocache
High performance and lightweight in-memory cache library with LRU and FIFO support as well as memory-usage-based-eviction
Stars: ✭ 15 (-86.11%)
Mutual labels:  lru, lru-cache
disk-lru-cache
💾 Disk LRU cache with persisted journal
Stars: ✭ 21 (-80.56%)
Mutual labels:  lru, lru-cache
hyperlru
Tiny & Fast LRU Implementation as possible.
Stars: ✭ 34 (-68.52%)
Mutual labels:  lru, lru-cache
Olric
Distributed cache and in-memory key/value data store. It can be used both as an embedded Go library and as a language-independent service.
Stars: ✭ 2,067 (+1813.89%)
Mutual labels:  lru, lru-cache
golib
Open version of common golang libraries useful to many projects.
Stars: ✭ 47 (-56.48%)
Mutual labels:  lru, lru-cache
go-cache-benchmark
Cache benchmark for Golang
Stars: ✭ 47 (-56.48%)
Mutual labels:  lru, lru-cache
memo-async-lru
Memoize Node.js style callback-last functions, using an in-memory LRU store
Stars: ✭ 17 (-84.26%)
Mutual labels:  lru, lru-cache
truthy
Package truthy provides truthy condition testing with Go generics
Stars: ✭ 31 (-71.3%)
Mutual labels:  generics
Stack
A Type-Safe, Thread-Safe-ish approach to CoreData in Swift
Stars: ✭ 47 (-56.48%)
Mutual labels:  generics
parco
🏇🏻 generalist, fast and tiny binary parser and compiler generator, powered by Go 1.18+ Generics
Stars: ✭ 57 (-47.22%)
Mutual labels:  generics
mcache
An in-memory cache library for golang. support: lru,lfu,hash-lru,hash-lfu,arc. 一个高性能本地内存缓存,带有各种内存淘汰算法
Stars: ✭ 311 (+187.96%)
Mutual labels:  lru
generics
Deprecated! See https://github.com/golang-design/go2generics.
Stars: ✭ 26 (-75.93%)
Mutual labels:  generics
genx
GenX: Generics For Go, Yet Again.
Stars: ✭ 37 (-65.74%)
Mutual labels:  generics
Java-Programs
Java Practiced Problems including concepts of OOPS, Interface, String , Collection.
Stars: ✭ 51 (-52.78%)
Mutual labels:  generics
Java-Interview-Programs
Core Java Projects with complete source code
Stars: ✭ 48 (-55.56%)
Mutual labels:  generics
generic-simd
Generic SIMD abstractions for Rust.
Stars: ✭ 45 (-58.33%)
Mutual labels:  generics
go-callbag
golang implementation of Callbag
Stars: ✭ 19 (-82.41%)
Mutual labels:  generics
ttlcache
An in-memory cache with item expiration and generics
Stars: ✭ 468 (+333.33%)
Mutual labels:  generics

LRU Cache

A simple LRU cache using go generics.

Examples

Basic usage.

func main() {
    cache := lru.New[string, string]()
    cache.Set("key", "value")
    value, _ := cache.Get("key")
    fmt.Println(value)
}

Set the capacity using the lru.WithCapacity option. The default capacity is set to 10000.

func main() {
    cache := lru.New[string, string](lru.WithCapacity(100))
    ...
}

A thread safe implementation is included for convenience.

func main() {
    cache := lru.NewSync[string, string](lru.WithCapacity(100))
    ...
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].