dgraph-io/ristretto

A high performance memory-bound Go cache

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 31 minutes ago
Added to GitGenius on September 9th, 2026
Created on February 12th, 2019
Open Issues & Pull Requests: 14 (+0)
GitHub issues: Enabled
Number of forks: 445
Total Stargazers: 6,989 (+0)
Total Subscribers: 70 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

Ristretto is a high-performance, memory-bound cache library for Go that prioritizes concurrent access and hit ratio optimization.

The library addresses the need for a contention-free cache by combining two specialized policies: SampledLFU for eviction and TinyLFU for admission. This pairing is designed to achieve high hit ratios across diverse workload patterns while maintaining excellent throughput under concurrent access. The tool uses cost-based eviction, allowing valuable large items to displace multiple smaller items when needed, and employs various contention-management techniques to support many goroutines with minimal performance degradation. Optional metrics provide visibility into throughput, hit ratios, and other performance characteristics.

Ristretto suits projects where cache performance directly impacts application responsiveness and where concurrent access patterns are common. The library offers two major versions: the original v1.x.x for existing programs and v2.x.x with generics support and a revised interface, recommended for new projects. The README benchmarks demonstrate hit ratio performance across search, database, looping, and CODASYL workload traces, as well as throughput comparisons for mixed and read-heavy scenarios. Configuration is straightforward, requiring developers to set appropriate Config values before use.

The project maintains active engagement with real-world usage, documenting production deployments. Development shows sustained attention to both correctness and performance optimization, with the codebase supporting multiple Go versions and providing clear upgrade paths between major versions. The project includes comprehensive benchmarking infrastructure and maintains documentation of performance characteristics across different access patterns.