API Reference

BigCache

An efficient in-memory cache for Go that holds gigabytes of data without GC pressure.

Official Documentation ↗
CompatibilityThis documentation covers version v3.2. Check the official docs for the latest API surface.

Installation

gogo get github.com/allegro/bigcache/v3

Methods

BigCache stores entries in a large byte array with hash indexing to minimize allocations.

Key Features

  • Off-heap-style byte storage
  • Sharded for concurrency
  • TTL and lifecycle callbacks

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The official API reference declares the following error types:

  • bigcache.ErrEntryNotFound (var error (errors.New)) — official text: “var ( // ErrEntryNotFound is an error type struct which is returned when entry was not found for provided key ErrEntryNotFound = errors.New(“Entry not found”) //nolint:staticcheck // keep for backward compatibility” (source: https://raw.githubusercontent.com/allegro/bigcache/v3.2.0/entry_not_found_error.go, fetched 2026-11-08T16:02:45+08:00)

API reference evidence

Fetched from official sources on 2026-11-08T16:02:45+08:00 via WebFetch pkg.go.dev + PowerShell Invoke-WebRequest raw.githubusercontent.com (allegro/bigcache v3.2.0).

FAQ

Why does it store bytes only?
Values are kept in a byte array to avoid per-entry allocations; serialize objects before storing them.
How does BigCache reduce GC pressure?
It allocates blocks up front and copies variable entries into them, so the garbage collector scans few large objects.
What happens when it is full?
New entries are not admitted; size the cache or delete entries to make room, since eviction is not recency-based by default.