Async Rust client for Truespar Forge, an in-memory store, over Forge's binary TCP protocol.
Forge itself is not public. This client is, so software that talks to Forge - Sentio, for one - can be built by anyone. It is developed inside Truespar's Forge repository, next to the server whose protocol it speaks, and this repository is a mirror published from there. A pull request here cannot be merged as-is; open an issue instead.
use forge_client::ForgeClient;
let mut client = ForgeClient::connect("127.0.0.1:6380").await?;
client.ping().await?;
// Key-value
client.set(b"key", b"value", 0).await?;
let val = client.get(b"key").await?; // Some(b"value")
// Every TTL is in milliseconds, in both directions.
client.set(b"temp", b"data", 60_000).await?; // 60 seconds
client.expire(b"key", 300_000).await?; // 5 minutes
let remaining_ms = client.ttl(b"key").await?; // -1 no TTL, -2 no key
// Delete one key; true if it existed
let existed = client.del(b"key").await?;
// Counters
let n = client.incr(b"hits").await?; // 1 on a missing key
let score = client.incr_by_float(b"reputation:203.0.113.7", 2.5).await?;
// Keyspace: every key matching a glob, paged 100 at a time
let bans = client.scan_all(b"sentio:smtp:ban:*").await?;
// Hash
client.hset(b"user:1", b"name", b"Alice").await?;
let name = client.hget(b"user:1", b"name").await?;
let first = client.hsetnx(b"user:1", b"created", b"2026-09-25").await?;| Category | Methods |
|---|---|
| Key-value | get, set (with TTL), del, exists, get_del |
| TTL | expire, persist, ttl (all milliseconds) |
| Counters | incr, decr, incr_by_float |
| Keyspace | scan (one page), scan_all (every page) |
| Hash | hset, hsetnx, hget, hdel, hgetall, hlen, hexists |
| Admin | ping |
A ForgeClient owns one connection and every method takes &mut self, so there is
one request in flight per client. Run several clients for concurrency.
A request cancelled halfway - a dropped future, a timeout around it - leaves its response unread on the connection, and the next call would read that one instead of its own. After an error or a cancellation, throw the client away and connect again.
Forge's binary TCP protocol, port 6380 by default: length-prefixed frames, no RESP and no HTTP.
MIT OR Apache-2.0.