SDKs
Six official clients, one behavior. Point any of them at a single node or at a discovery server — the SDK detects which from the server's own handshake, so development and production use identical code.
Every SDK ships the full feature set: authentication, TLS, discovery seeds, replication-aware routing (reads fail over, writes fan out to all R owners), transparent reconnect with a single retry, optional keep-alive, and the same rendezvous-hashing pipeline verified against shared cross-language test vectors.
| Language | Requires | Package | Docs |
|---|---|---|---|
| TypeScript / Node.js | Node 20+ | nanocached (npm) | README |
| Python | 3.11+, asyncio | nanocached (PyPI) | README |
| Java | 17+ | org.nanocached:nanocached (Maven Central) | README |
| Rust | tokio | nanocached (crates.io) | README |
| .NET | .NET 8+ | Nanocached (NuGet) | README |
| Go | 1.22+ | github.com/nanocached/nanocached/sdk/go | README |
None of the SDKs has runtime dependencies outside its language's
standard library (Rust's client uses tokio; TLS sits behind the
tls feature).
v1.0.0 is the first published release. If a registry
doesn't list the package yet, the release is still rolling out — every
SDK also builds directly from the
repository.
TypeScript
npm install nanocached
import { NanocachedClient } from "nanocached";
const client = await NanocachedClient.connect({ host: "127.0.0.1", port: 8357 });
await client.set("greeting", "hello", { ttlSeconds: 60 });
const value = await client.get("greeting"); // Buffer | null
const existed = await client.delete("greeting"); // boolean
client.close();
Python
pip install nanocached
import asyncio
from nanocached import NanocachedClient
async def main():
client = await NanocachedClient.connect("127.0.0.1", 8357)
await client.set("greeting", "hello", ttl_seconds=60)
value = await client.get("greeting") # bytes | None
existed = await client.delete("greeting") # bool
client.close()
asyncio.run(main())
Java
Group/artifact: org.nanocached:nanocached.
import org.nanocached.NanocachedClient;
try (NanocachedClient client = NanocachedClient.connect("127.0.0.1", 8357)) {
client.set("greeting", "hello", 60); // TTL in seconds (optional)
byte[] value = client.get("greeting"); // null when missing
boolean existed = client.delete("greeting");
}
Rust
cargo add nanocached
use nanocached::{NanocachedClient, Options};
let client = NanocachedClient::connect(Options::new().host("127.0.0.1", 8357)).await?;
client.set("greeting", "hello", Some(60)).await?; // TTL in seconds
let value: Option<Vec<u8>> = client.get("greeting").await?;
let existed: bool = client.delete("greeting").await?;
client.close();
.NET
dotnet add package Nanocached
using Nanocached;
using NanocachedClient client = await NanocachedClient.ConnectAsync("127.0.0.1", 8357);
await client.SetAsync("greeting", "hello", ttlSeconds: 60);
byte[]? value = await client.GetAsync("greeting"); // null when missing
bool existed = await client.DeleteAsync("greeting");
Go
go get github.com/nanocached/nanocached/sdk/go
import nanocached "github.com/nanocached/nanocached/sdk/go"
client, err := nanocached.Connect(nanocached.Config{
Seeds: []string{"127.0.0.1:8357"},
})
if err != nil { /* ... */ }
defer client.Close()
err = client.Set("greeting", []byte("hello"), 60*time.Second) // 0 = no expiry
value, ok, err := client.Get("greeting") // ok=false when missing
existed, err := client.Delete("greeting")
Shared behavior, briefly
- Discovery seeds — list every discovery replica; connect and refresh try them in order, skipping busy or unreachable seeds.
- Replication — R rides along with the node list, so there is nothing to configure; each client exposes the factor in use.
- Failure recovery — a stale routing table (a node answers
W) or a dead primary both trigger one node-list refresh and one retry; recovery is bounded by discovery's liveness timeout. - Reconnect — nodes close idle connections after 30 s; SDKs redial lazily on next use, or keep connections warm with the opt-in keep-alive interval.
- Concurrency — every client is safe for concurrent use; requests are serialized per connection.