EVERYTHING XIAOMI
Get listed

Ristretto

Ristretto is a free, open-source Go library for an in-process cache of key-value data.

Place
#13 of 27
Score
6.0
Ristretto's website

What Ristretto is

Ristretto is a free, open-source Go library for an in-process cache of key-value data. It is designed for performance, correctness, and concurrent use, with cache data held in memory within a single process rather than distributed across processes. TinyLFU admission and SampledLFU eviction are used to target high hit ratios. Applications define item costs, allowing one valuable large item to displace several smaller ones. The project attributes throughput to contention management, batching, and eventual consistency; it also says goroutines can use the cache concurrently with little throughput degradation. Optional metrics cover throughput, hit ratios, and other statistics. A Set for a new item may be dropped in the Set buffer or admission policy, while updates are guaranteed. Ristretto requires Go 1.21 or later 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 Ristretto as production-ready. Its README names Badger and Dgraph as users of the library.

Good

  • Free and open source under Apache License 2.0.
  • Supports concurrent use by goroutines.
  • Optional metrics cover throughput and hit ratios.
  • Version 2 supports generics.
  • Applications can define item costs.

Watch out

  • It is an in-process library, not distributed.
  • A new-item Set may be dropped.
  • Requires Go 1.21 or above and Go modules.

Who it suits

Ristretto may suit Go developers who need a concurrent, in-process cache and can account for the possibility that a new-item Set is dropped.

Verdict

Ristretto provides a Go cache with configurable item costs, optional metrics, and concurrent use. Its single-process scope and possible dropped Sets for new items matter when evaluating whether it fits an application.

Plans and prices

From Ristretto's own pricing page, checked 8 Oct 2026.

All about pricing
PlanPriceWhat it gives you
RistrettoFreeOpen-source Go library · in-process cache

The facts

Each one read from Ristretto's own pages, with the date it was checked.

What it does

Admission and eviction
It pairs TinyLFU admission with SampledLFU eviction to target high hit ratios.checked 8 Oct 2026
Concurrency
The cache supports concurrent use by goroutines with little throughput degradation, according to the project.checked 8 Oct 2026
Deployment scope
Ristretto is a Go library used in a single process and is not distributed.checked 8 Oct 2026
Generics
Version 2 supports generics and is recommended by the project for new programs.checked 8 Oct 2026
Known users
The README lists Badger and Dgraph as projects using Ristretto.checked 8 Oct 2026
License
The repository is licensed under Apache License, Version 2.0.checked 8 Oct 2026
Metrics
Optional metrics cover throughput, hit ratios, and other statistics.checked 8 Oct 2026
Production status
The README describes Ristretto as production-ready.checked 8 Oct 2026
Purpose
Ristretto is a fast, concurrent, memory-bound Go cache library focused on performance and correctness.checked 8 Oct 2026
Requirements
The project says to install Go 1.21 or above and use Go modules.checked 8 Oct 2026
Set behavior
A Set for a new item may be dropped while passing through the Set buffer or admission policy, while updates are guaranteed.checked 8 Oct 2026
Throughput
The project attributes its throughput to techniques for managing contention, batching, and eventual consistency.checked 8 Oct 2026

Money

Cost-based eviction
A valuable large item can evict multiple smaller items, with cost defined by the application.checked 8 Oct 2026

Alternatives to Ristretto

All alternatives
  1. 1Amazon ElastiCache logo

    Amazon ElastiCache

    Free planWebAPILinuxmacOS
    7.9From $0.09 a month
  2. 2Apache Traffic Server logo

    Apache Traffic Server

    Free planOpen sourceAPILinuxmacOSSelf-hosted
    7.2Free plan
  3. 3

    Ehcache

    Free planOpen sourceAPISelf-hosted
    6.9Free plan
  4. 4Aiven for Valkey logo

    Aiven for Valkey

    Free planWebAPILinux
    6.8From $15 a month
  5. 5
    6.4From $0.05 a month
  6. 6

    cache2k

    Free planAndroidAPILinuxSelf-hosted
    6.2Free plan