Benchmarks of in-memory cache libraries for Golang.
go test -bench=. -benchmem -count 5 -benchtime=100000x > results/results.out
All the benchmarks are performed in the Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
machine with 100K
samples and 5
iterations.
- akyoto/cache - Cache arbitrary data with an expiration time.
- allegro/bigcache - Efficient cache for gigabytes of data written in Go.
- bluele/gcache - An in-memory cache library for golang. It supports multiple eviction policies: LRU, LFU, ARC.
- coocood/freecache - A cache library for Go with zero GC overhead.
- dgraph-io/ristretto - A high performance memory-bound Go cache.
- floatdrop/2q - Thread safe GoLang 2Q cache.
- floatdrop/lru - Thread safe GoLang LRU cache
- floatdrop/slru - Thread safe GoLang S(2)LRU cache.
- hashicorp/golang-lru - Golang LRU cache
- jellydator/ttlcache - An in-memory cache with item expiration and generics
- koding/cache - Caching package for Go
- irr123/wtfcache - Threadsafe cache with generic interface
- muesli/cache2go - Concurrency-safe Go caching library with expiration capabilities and access counters.
- patrickmn/go-cache - An in-memory key:value store/cache (similar to Memcached) library for Go, suitable for single-machine applications.
- sync#Map - Safe for concurrent use by multiple goroutine without additional locking or coordination. Loads, stores, and deletes run in amortized constant time.
- VictoriaMetrics/fastcache - Fast thread-safe in memory cache for big number of entries in Go. Minimizes GC overhead.
- Test data is generated using mockaroo