# eko/gocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches

Repository: https://github.com/eko/gocache
Canonical: https://ross.abutalabs.com/products/gocache
Homepage: https://vincent.composieux.fr/article/i-wrote-gocache-a-complete-and-extensible-go-cache-library/
Language: Go
License: MIT
License Family: permissive
Topics: go, golang, cache, memcache, redis, memory, ristretto, bigcache, chain, hacktoberfest
Last push: 2026-07-26T21:15:56+00:00

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 94, release rhythm 95, longevity 100
- inputs: {"age_days": 2524, "days_push": 38, "days_rel": 38, "gap_med": 2, "n_releases_24m": 14}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2881, forks 223 (observed 2026-08-28T04:07:28.031246+00:00)

## What it is
Gocache is an extensible Go caching library providing a unified API over multiple cache stores such as in-memory (bigcache, ristretto, go-cache, freecache), Redis, Memcache, Pegasus, and Hazelcast. It supports chained caches with priority ordering, loadable caches via callbacks, tag-based invalidation, generics, and Prometheus metrics.

## Use cases
- cache data in Go with a unified API across memory and Redis
- add a memory cache that falls back to a shared distributed cache
- track cache hits, misses, and set errors with Prometheus
- invalidate cached items by expiration time or tags
- automatically load data into cache via a callback function
- marshal and unmarshal cached values as Go structs

## When to choose
- you need one consistent cache interface across multiple backends in Go
- you want layered caching (local memory plus distributed Redis)
- you need cache usage metrics exported to Prometheus
- you want tag-based or expiration-based cache invalidation

## When to avoid
- you only need a simple single in-memory cache with no abstraction
- your project is not written in Go
- you need features like cross-instance invalidation or persistence built in

## Facets
- artifact type: library
- maturity: active
- function: caching, serialization, monitoring
- domain: developer-tools, backend, databases, web-development
- platform: go, cross-platform
- tags: cache-library, multi-store, chain-cache, redis, memcache, ristretto, bigcache, prometheus-metrics, tag-invalidation, generics

## Member repositories
- eko/gocache (main) score 96

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:28.031246+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:48:25.825790+00:00, confidence not recorded.
  - readme: https://github.com/eko/gocache (fetched 2026-08-28T04:07:28.031246+00:00, sha 2cc1b1d72361)
  - homepage: https://vincent.composieux.fr/article/i-wrote-gocache-a-complete-and-extensible-go-cache-library/ (fetched 2026-08-29T09:50:56.981551+00:00, sha b6f45856fc4e)
- Data as of 2026-08-30T08:39:29.467469+00:00.
