# moka-rs/moka

A high performance concurrent caching library for Rust

Repository: https://github.com/moka-rs/moka
Canonical: https://ross.abutalabs.com/products/moka
Language: Rust
License: Apache-2.0
License Family: permissive
Topics: cache, concurrent-data-structure
Last push: 2026-08-09T23:17:14+00:00

## Health v2 (maintenance only)
Score: 93/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 84, longevity 100
- inputs: {"age_days": 2341, "days_push": 24, "days_rel": 24, "gap_med": 34.5, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2670, forks 126 (observed 2026-08-28T04:07:09.430964+00:00)

## What it is
Moka is a fast, concurrent in-memory caching library for Rust, inspired by Java's Caffeine. It provides thread-safe synchronous and async caches with size bounding, TinyLFU admission/LRU eviction, TTL/TTI expiration, and eviction listeners.

## Use cases
- cache expensive computation results in a Rust application
- add an in-memory cache with TTL expiration to my API server
- bound a shared hashmap by entry count or weighted size
- share a thread-safe cache across OS threads
- use an async-aware cache in a Tokio service
- improve cache hit ratio with LFU-based admission
- run callbacks when cache entries are evicted

## When to choose
- you need a high-performance concurrent cache in Rust with near-optimal hit ratios
- you want Caffeine-like eviction policies (TinyLFU admission, LRU eviction) in Rust
- you need both sync and async cache APIs with TTL, TTI, and per-entry expiration
- you need size-aware eviction or eviction listener callbacks

## When to avoid
- you need a distributed or shared cache across processes or machines (use Redis or similar)
- you need persistent or on-disk caching
- you are not working in Rust

## Facets
- artifact type: library
- maturity: stable
- function: caching
- domain: developer-tools, performance, backend
- platform: rust, cross-platform
- tags: in-memory-cache, concurrent, caffeine-inspired, lfu, lru, ttl, async

## Member repositories
- moka-rs/moka (main) score 93

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:09.430964+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:18:10.949160+00:00, confidence not recorded.
  - readme: https://github.com/moka-rs/moka (fetched 2026-08-28T04:07:09.430964+00:00, sha 5dbde351d222)
  - registry_crates: https://crates.io/api/v1/crates/moka (fetched 2026-08-29T10:00:44.580786+00:00, sha 6622426cf602)
- Data as of 2026-08-30T08:39:29.467469+00:00.
