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
go
go get github.com/allegro/bigcache/v3Methods
No methods match this filter.
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).
bigcache.New→ signature from https://raw.githubusercontent.com/allegro/bigcache/v3.2.0/bigcache.go; official text: “func New(ctx context.Context, config Config) (*BigCache, error) {”BigCache.Set→ signature from https://raw.githubusercontent.com/allegro/bigcache/v3.2.0/bigcache.go; official text: “func (c *BigCache) Set(key string, entry []byte) error {”BigCache.Get→ signature from https://raw.githubusercontent.com/allegro/bigcache/v3.2.0/bigcache.go; official text: “// It returns an ErrEntryNotFound when // no entry exists for the given key. func (c *BigCache) Get(key string) ([]byte, error) {”
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.
Report a problem with this API docOpens a pre-filled issue on GitHub.