lru
A simple, fast O(1) LRU cache implementation for Rust
Repository Health
Technical Analysis
lru is a minimal, dependency-light LRU (least-recently-used) cache for Rust, providing put, get, get_mut, and pop operations that all run in O(1) time. It was originally derived from the LRU cache implementation once found in an early version of Rust’s own std::collections before that module was removed, and remains one of the most widely depended-upon caching crates in the Rust ecosystem.
The crate is intentionally small in scope — a single LruCache type backed by an internal hash map and doubly linked list — making it easy to audit, embed, and use in both std and no_std (via the optional hashbrown backend) environments.
What You Get
- A generic
LruCache<K, V>type with O(1) put/get/get_mut/pop/peek operations - Optional
hashbrown-backed hash map for faster lookups andno_stdsupport - Iterator support for inspecting cache contents in recency order
- A
nightlyfeature flag for opting into nightly-only hashbrown optimizations - Zero required runtime dependencies beyond the optional hashbrown backend
Common Use Cases
- Bounding memory use of an in-process cache (e.g. parsed config, compiled regexes, DB query results)
- Implementing eviction policy for a connection pool or object pool
- Building a simple in-memory HTTP response or asset cache inside a Rust web service
- Embedding a bounded cache inside a
no_stdor embedded Rust project via the hashbrown backend
Under The Hood
Architecture — The entire implementation lives in a single src/lib.rs (~3,200 lines including tests and docs), structured around an internal hash map from keys to nodes of a doubly-linked list; get/put move the touched node to the front of the list while pop/eviction removes from the back, giving the classic O(1) LRU behavior without a separate background thread or lock.
Tech Stack — Pure Rust with a 1.85.0 MSRV, categorized under caching and no-std on crates.io; the only dependency is the optional hashbrown crate (enabled by default) used as a faster/no_std-compatible hash map, with scoped_threadpool and stats_alloc present only as dev-dependencies for benchmarking.
Code Quality — The crate carries an extensive inline test suite directly in lib.rs covering capacity edge cases, eviction order, and the get_mut/peek variants, plus a CHANGELOG.md tracking version-by-version behavior changes, indicating a project that takes API stability seriously despite its small surface area.
API Design — The API deliberately mirrors the ergonomics of std::collections::HashMap (put/get/get_mut/pop) so it requires almost no learning curve for anyone familiar with Rust’s standard collections, and the NonZeroUsize capacity parameter statically rules out the common zero-capacity-cache bug at the type level.
Used by 9 apps in this directory
Cap
Team Chat · Video Conferencing
Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.
Fluree DB
Databases
A temporal, verifiable graph database with git-like branching, integrated vector/text/geo search, and RDF/SPARQL/JSON-LD/openCypher support — benchmarked at 10.4x faster than the next database on the full Wikidata dump.
headroom
AI Development · Developer Tools
Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.
Hoppscotch
Developer Tools
A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.
LocalSend
Networking
An open-source, cross-platform AirDrop alternative that sends files and messages device-to-device over your local network with no internet, no account, and no cloud server involved.
Meilisearch
Search
Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.
Memgraph
Databases · AI Development
High-performance in-memory graph database for AI context and real-time analytics
OpenViking
Databases · AI Development
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.
Vibe Kanban
AI Agents · AI Code Assistants · Project Management
A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.