Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. theine

theine

MITGov0.6.2

A high-performance in-memory and hybrid cache for Go, featuring adaptive W-TinyLFU eviction and hierarchical timer wheels.

GitHubGitHub
376 stars23 forks0 contributors

What is theine?

Theine is a high-performance in-memory and hybrid cache library for Go, inspired by Caffeine. It provides efficient caching with excellent hit ratios using adaptive W-TinyLFU eviction and automatic expiration management via hierarchical timer wheels, making it suitable for performance-critical applications.

Target Audience

Go developers building high-performance applications that require efficient in-memory caching, such as web servers, microservices, or data-intensive systems where low latency and high throughput are critical.

Value Proposition

Developers choose Theine for its combination of high hit ratios from adaptive W-TinyLFU, efficient expiration handling with hierarchical timer wheels, and a clean, idiomatic Go API with generics support, offering a robust alternative to libraries like Ristretto and Otter.

Overview

high performance in-memory cache

Use Cases

Best For

  • Implementing high-performance in-memory caching in Go microservices to reduce database load and improve response times.
  • Applications requiring automatic cache expiration with efficient time-based management using hierarchical timer wheels.
  • Scenarios where cache persistence is needed, allowing cache state to be saved and restored via Gob encoding.
  • Hybrid caching setups that integrate in-memory caching with secondary non-volatile media for extended data retention.
  • Systems with heavy concurrent write loads that benefit from configurable entry pooling to minimize memory allocations.
  • Use cases demanding high cache hit ratios under varying access patterns, leveraging adaptive W-TinyLFU eviction policies.

Not Ideal For

  • Projects requiring distributed caching across multiple nodes, as Theine is focused on in-memory and local hybrid caching without built-in clustering.
  • Applications where cache persistence must be seamlessly compatible across library upgrades, due to version mismatch warnings and potential incompatibility.
  • Use cases demanding extensive real-time monitoring or advanced cache statistics beyond basic hit ratios and misses.
  • Environments with extremely low memory overhead requirements, as Theine's adaptive policies and data structures may introduce more complexity than simpler caches.

Pros & Cons

Pros

Adaptive High Hit Ratios

Uses W-TinyLFU eviction that dynamically adapts to access patterns, achieving excellent hit ratios as demonstrated in benchmarks with distributions like zipf and s3.

Efficient Expiration Management

Implements hierarchical timer wheels to automatically remove expired entries with minimal performance overhead, ensuring timely cleanup.

Modern Generics API

Supports Go generics for type-safe caching of any key-value types, providing a clean and idiomatic interface that reduces boilerplate.

Cache Persistence Support

Allows saving and restoring cache state via Gob encoding, useful for stateful applications that need to maintain cache across restarts, though with versioning caveats.

Cons

Experimental Hybrid Cache

Secondary cache integration is labeled experimental, with limitations like no persistence support and only REMOVED events for removal listeners, making it unreliable for production.

Persistence Version Lock-in

Cache persistence files are not guaranteed to be compatible across Theine versions, requiring manual management or cache warm-up after upgrades, as noted in the documentation.

Configuration Complexity

Options like UseEntryPool and Doorkeeper introduce tuning complexity and potential race conditions if misconfigured, adding overhead for developers unfamiliar with internal mechanics.

Open Source Alternative To

theine is an open-source alternative to the following products:

C
Caffeine

Caffeine is a utility for macOS that prevents the system from going to sleep or activating screen savers, keeping the computer awake indefinitely.

Frequently Asked Questions

Quick Stats

Stars376
Forks23
Contributors0
Open Issues5
Last commit10 months ago
CreatedSince 2023

Tags

#in-memory-cache#high-performance#hybrid-cache#cache#concurrency#caching-library#go#performance

Built With

G
Go

Included in

Go169.1k
Auto-fetched 18 hours ago

Related Projects

groupcachegroupcache

groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.

Stars13,340
Forks1,392
Last commit1 year ago
BigCacheBigCache

Efficient cache for gigabytes of data written in Go.

Stars8,149
Forks611
Last commit4 days ago
ristrettoristretto

A high performance memory-bound Go cache

Stars6,969
Forks444
Last commit9 days ago
gocachegocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches

Stars2,877
Forks223
Last commit21 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub