Ristretto
github.com
- Free plan
- Windows
- macOS
- Linux
- Self-hosted
What Ristretto is
Ristretto is a free, open-source Go library for an in-process cache of key-value data. It is designed for concurrent use, performance, and correctness, with TinyLFU admission and SampledLFU eviction policies intended to target high hit ratios. Applications define item cost, allowing a valuable large item to evict several smaller ones. The project attributes the library’s throughput to contention management, batching, and eventual consistency. Goroutines can use the cache concurrently with little throughput degradation, according to the project, and optional metrics cover throughput, hit ratios, and other statistics. A Set for a new item may be dropped while it passes through the Set buffer or admission policy; updates are guaranteed. Ristretto runs within a single process and is not distributed. It requires Go 1.21 or above and Go modules. Version 2 supports generics, and the project recommends it for new programs. The repository uses the Apache License, Version 2.0, and describes the library as production-ready. Its README names Badger and Dgraph as projects using it.
Who it suits
Ristretto suits Go developers who need a concurrent in-process cache and can account for new-item Sets being dropped. It is not suited to deployments that require a distributed cache.
Good to know, and what to watch
- Free, open-source library under Apache License 2.0
- TinyLFU admission and SampledLFU eviction
- Optional throughput and hit-ratio metrics
- Version 2 supports generics
- Not distributed; it runs in a single process
- New-item Sets may be dropped
- Requires Go 1.21 or above and Go modules
- Cache data is held in memory without persistence
Plans
Every plan and priceRistretto
Open source
Getting started
- Open the Ristretto GitHub repository
- Install Go 1.21 or above
- Enable Go modules for the project
- Choose version 2 for generics support in a new program
- Integrate the library through its Go API
Limits to check
Ristretto is limited to a single process and does not persist cache data. A new item can be discarded while passing through the Set buffer or admission policy, although updates are guaranteed.
The verdict
Ristretto is a focused in-process cache for Go programs, with policies and metrics aimed at performance and high hit ratios. Account for possible drops of new-item Sets and the single-process scope when deciding whether it fits.
Questions people ask
Is Ristretto free?
Yes. It is listed as free and open source under the Apache License, Version 2.0.
Which platforms does it support?
The listed platforms are Linux, macOS and Windows, with self-hosted deployment.
Is Ristretto distributed?
No. It is a Go cache library used within a single process.
Does it support TTL?
Yes, TTL support is listed.
Does it persist data?
No. Data persistence is not provided.
What does it require?
The project says to use Go 1.21 or above with Go modules.
What the maker publishes
- Admission and eviction
- It pairs TinyLFU admission with SampledLFU eviction to target high hit ratios. source
- Concurrency
- The cache supports concurrent use by goroutines with little throughput degradation, according to the project. source
- Cost-based eviction
- A valuable large item can evict multiple smaller items, with cost defined by the application. source
- Deployment scope
- Ristretto is a Go library used in a single process and is not distributed. source
- Generics
- Version 2 supports generics and is recommended by the project for new programs. source
- Known users
- The README lists Badger and Dgraph as projects using Ristretto. source
- License
- The repository is licensed under Apache License, Version 2.0. source
- Metrics
- Optional metrics cover throughput, hit ratios, and other statistics. source
- Production status
- The README describes Ristretto as production-ready. source
- Purpose
- Ristretto is a fast, concurrent, memory-bound Go cache library focused on performance and correctness. source
- Requirements
- The project says to install Go 1.21 or above and use Go modules. source
- Set behavior
- A Set for a new item may be dropped while passing through the Set buffer or admission policy, while updates are guaranteed. source
- Throughput
- The project attributes its throughput to techniques for managing contention, batching, and eventual consistency. source
Checked against the maker's pages on 8 Oct 2026.