Getting Started
Redis setup
Build a Redis connection manager that your distkit primitives can share.
Every distkit primitive is constructed with a redis::aio::ConnectionManager. The connection manager is cheap to clone and reconnects on its own, so you build it once and hand a clone to each counter or lock.
A Redis to talk to
For local development, any Redis 5.0+ works. With Docker:
docker run --rm -p 6379:6379 redis:7.2-alpine
distkit only needs standard Redis - no modules.
Building a connection
let client = redis::Client::open("redis://127.0.0.1/")?;
let conn = client.get_connection_manager().await?;
conn is a ConnectionManager. Clone it freely - clones share the same underlying connection pool:
let counter = StrictCounter::new(CounterOptions::new(prefix.clone(), conn.clone()));
let mutex = Mutex::new(LockOptions::new(key, conn.clone()));
Keys and namespacing
distkit wraps every key in a DistkitRedisKey, which validates it (non-empty, at most 255 bytes, no :). The colon is reserved because distkit uses it internally to namespace the keys it writes, so your data never collides with distkit's bookkeeping.
use distkit::DistkitRedisKey;
let prefix = DistkitRedisKey::try_from("my_app".to_string())?;
let key = DistkitRedisKey::try_from("page_views".to_string())?;
Next steps
- Quickstart - put it together.
- Keys - the rules for valid keys.

