Caches

31 projects

This subcategory covers caching inside a Go process and libraries that front external stores such as Redis or Memcached. In-process caches differ mainly in eviction policy (LRU, LFU, TinyLFU and variants), whether entries expire by time, how they behave under heavy concurrency, and how they limit garbage collector pressure when holding millions of entries.

ristretto from Dgraph uses an admission policy and cost-based eviction, and maypok86/otter is a newer lock-free cache built around generics that publishes its own comparisons with ristretto. theine is another generic cache with proactive expiration. allegro/bigcache and VictoriaMetrics' fastcache store byte slices in large preallocated buffers so the garbage collector does not scan each entry, which suits large caches of serialized values. jellydator/ttlcache is a simple generic cache with expiration. golang/groupcache fills a distributed cache across peers but has no expiration or deletion and has been quiet since 2024. eko/gocache chains memory, Redis and other stores behind one interface, and sturdyc adds request coalescing and background refresh.

For most services, a generic in-memory cache like otter, theine or ttlcache is enough. Choose bigcache or fastcache when entries are already []byte and the cache is large. Add a shared store such as Redis when several instances must see the same data, and always protect expensive loads from stampedes by coalescing duplicate requests.

groupcacheby golang

Groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.

github.com/golang/groupcacheGo 1.20+ 1 dependencyupdated 1y ago

13.3k

BigCacheby allegro

Efficient key/value cache for gigabytes of data.

github.com/allegro/bigcache/v3Go 1.22+ No dependencies v3.2.0updated 21d ago

8.2k

ristrettoby dgraph-io

A high performance memory-bound Go cache.

github.com/dgraph-io/ristretto/v2Go 1.24+ 5 dependenciesv2.4.2updated 1mo ago

7k

gocacheby eko

A complete Go cache library with multiple stores (memory, memcache, redis,...), chainable, loadable, metrics cache and more.

lib/v4.4.0updated 2d ago

2.9k

GCacheby bluele

Cache library with support for expirable Cache, LFU, LRU and ARC.

github.com/bluele/gcacheGo 1.15+ No dependencies updated 2y ago

2.7k

otterby maypok86

A high performance lockless cache for Go. Many times faster than Ristretto and friends.

github.com/maypok86/otter/v2Go 1.24+ 1 dependencyv2.4.0updated 5d ago

2.7k

fastcacheby VictoriaMetrics

Fast thread-safe inmemory cache for big number of entries. Minimizes GC overhead.

github.com/VictoriaMetrics/fastcacheGo 1.24+ 4 dependenciesv1.13.0updated 4mo ago

2.4k

cache2goby muesli

In-memory key:value cache which supports automatic invalidation based on timeouts.

github.com/muesli/cache2goGo 1.15+ No dependencies v0.2updated 2y ago

2.2k

ttlcacheby jellydator

An in-memory cache with item expiration and generics.

github.com/jellydator/ttlcache/v3Go 1.26+ 3 dependenciesv3.4.1updated 23d ago

1.3k

sturdycby viccon

A caching library with advanced concurrency features designed to make I/O heavy applications robust and highly performant.

github.com/viccon/sturdycGo 1.22+ 2 dependenciesv1.1.6updated 1mo ago

1.3k

EchoVault

Embeddable Distributed in-memory data store compatible with Redis clients.

github.com/echovault/sugardbGo 1.23+ 9 dependenciesv0.17.0updated 1y ago

539

jetcache-goby mgtv-tech

Unified Go cache library supporting multi-level caching.

github.com/mgtv-tech/jetcache-goGo 1.21+ 12 dependenciesv1.2.6updated 8mo ago

497

theineby Yiling-J

High performance, near optimal in-memory cache with proactive TTL expiration and generics.

github.com/Yiling-J/theine-goGo 1.20+ 4 dependenciesv0.6.2updated 5d ago

381

cachegoby faabiosr

Golang Cache component for multiple drivers.

archived

368

go-freelruby elastic

A GC-less, fast and generic LRU hashmap library with optional locking, sharding, eviction and expiration.

github.com/elastic/go-freelruGo 1.18+ No dependencies v0.16.0updated 13d ago

271

pocacheby naughtygopher

Pocache is a minimal cache package which focuses on a preemptive optimistic caching strategy.

github.com/naughtygopher/pocacheGo 1.26+ 2 dependenciesv0.4.0updated 1d ago

238

bcacheby iwanbk

Eventually consistent distributed in-memory cache Go library.

v0.2updated 3y ago

163

go-cacheby viney-shih

A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern.

github.com/viney-shih/go-cacheGo 1.18+ 8 dependenciesv1.1.5updated 3y ago

160

imcacheby erni27

A generic in-memory cache Go library. It supports expiration, sliding expiration, max entries limit, eviction callbacks and sharding.

github.com/erni27/imcacheGo 1.18+ No dependencies v1.2.1updated 1y ago

123

easycacheby hugocarreira

A simple way to use in-memory cache in Golang (TTL/FIFO/LRU/LFU).

github.com/hugocarreira/easycacheGo 1.25+ 1 dependencyv0.2.0updated 2mo ago

121

go-mcacheby OrlovEvgeny

Fast in-memory key:value store/cache library. Pointer caches.

github.com/OrlovEvgeny/go-mcacheGo 1.27+ 8 dependenciesv1.0.4updated 27d ago

107

timedmapby zekroTJA

Map with expiring key-value pairs.

github.com/zekroTJA/timedmap/v2Go 1.19+ 1 dependencyv2.0.0updated 2y ago

75

couchcacheby codingsince1985

RESTful caching micro-service backed by Couchbase server.

github.com/codingsince1985/couchcacheGo 1.19+ 2 dependenciesupdated 2y ago

64

clusteredBigCacheby oaStuff

BigCache with clustering support and individual item expiration.

v0.4updated 8y ago

45

gocacheby yuseferi

A data race free Go ache library with high performance and auto pruge functionality

github.com/yuseferi/gocache/v2Go 1.25+ No dependencies v2.0.1updated 10mo ago

24

icacheby mdaliyan

A High Performance, Generic, thread-safe, zero-dependency cache package.

github.com/mdaliyan/icache/v2Go 1.18+ No dependencies updated 1y ago

23

coherence-go-clientby oracle

Full implementation of Oracle Coherence cache API for Go applications using gRPC as network transport.

github.com/oracle/coherence-go-client/v2Go 1.23+ 4 dependenciesv2.3.1updated 6mo ago

15

nscacheby no-src

A Go caching framework that supports multiple data source drivers.

github.com/no-src/nscacheGo 1.24+ 10 dependenciesv0.1.3updated 5mo ago

15

gdcacheby ulovecode

A pure non-intrusive cache library implemented by golang, you can use it to implement your own distributed cache.

github.com/ulovecode/gdcacheGo 1.11+ No dependencies v0.2.18updated 5y ago

14

go-gcacheby szyhf

The generic version of GCache, cache support for expirable Cache, LFU, LRU and ARC.

github.com/szyhf/go-gcache/v2Go 1.18+ No dependencies updated 1y ago

12

ttlcacheby cheshir

In-memory key value storage with TTL for each record.

github.com/cheshir/ttlcacheGo 1.15+ No dependencies v1.0.0updated 4y ago

10
Esc

Type to search every entry. ↑↓ to move, Enter to open.