nanocached logo

nanocached

A tiny distributed in-memory cache written in Rust. One small binary per role, a wire protocol you can read with nc, and clients that do the clustering themselves — a discovery server only serves the node list, and a proxy is an option for clients that cannot route.

Experimental. nanocached is not ready for production use yet. The releases are 0.x: nothing is frozen before 1.0.0 (what it will promise is on the compatibility page), and the project is young — treat it accordingly.

Small on purpose

An in-memory key-value store with get / set / delete, optional TTL, and LRU eviction under a memory bound — plus atomic counters, compare-and-set, batched get/set, and namespaces with a clear. No persistence, no queries, no scripting.

Client-side clustering

Clients route keys with rendezvous hashing over a node list served by a lightweight discovery server. No proxy hop on the data path unless you run the optional proxy for clients that cannot hold the node list themselves.

Replication built in

Each key lives on its top-R nodes (default R=2). A node death costs no cached data: reads fail over, writes recover within seconds.

No single point of failure

Discovery replicas hold only soft state rebuilt from node announces — run several with zero coordination between them.

Auth and TLS, all or nothing

Shared-secret authentication and TLS are off by default and strictly required once enabled — no plaintext fallback.

A protocol you can read

ASCII headers, binary-safe bodies, one-byte commands. Debug a cluster with printf and nc.

Try it in a minute

docker pull ghcr.io/nanocached/nanocached-node:latest
docker run --rm --publish 8356:8356 ghcr.io/nanocached/nanocached-node:latest

# store "Alice" under "name", then read it back
printf 'S 4 5\nnameAliceG 4\nname' | nc 127.0.0.1 8356

The server answers S, then V 5 and Alice. That is the whole protocol experience — the reference fits on one page.

Six SDKs, one behavior

Every client speaks the same handshake, routes with the same hash, and recovers from the same failures — verified against shared cross-language test vectors.

TypeScriptPythonJava Rust.NETGo

Point any of them at a single node or at a discovery server; the SDK detects which from the server's own reply and behaves accordingly. See SDKs for install and quick-start snippets.

Plan before you size

Memory, effective capacity, replication factor, TTL, and hit rate trade off against each other — and only the binding constraint responds to tuning. The capacity planner is a self-contained, offline estimator that shows which lever actually moves your hit rate.