Skip to content

Releases: Usub-development/uredis

uRedis v0.0.1 — Async Redis client built on top of uvent

01 Dec 18:54

Choose a tag to compare

Release Notes — v0.0.1

This is the first complete public release of uRedis, an async-first Redis client library built directly on top of the uvent event loop.

The library now includes all major components required for production-grade Redis usage in a modern C++23 environment: single connections, connection pools, Sentinel discovery, Redis Cluster routing, robust pub/sub, reflection helpers, and a fully compliant distributed lock implementation (Redlock).


✨ Key Features in v0.0.1

1. RedisClient

Foundation of the library — a single async connection with full RESP handling.

  • Fully async (co_await-based)

  • Robust incremental RESP parser

  • Supports all core Redis commands:

    • KV (GET, SET, DEL, SETEX, INCRBY, etc.)
    • HASH (HSET, HGET, HGETALL)
    • SET (SADD, SMEMBERS)
    • LIST (LPUSH, LRANGE)
    • ZSET (ZADD, ZRANGE WITHSCORES)
  • Unified return types:

    • RedisResult<T>
    • RedisError
    • RedisValue

2. RedisPool

Ready for high-throughput workloads.

  • Round-robin pooling
  • Automatic parallel connect_all()
  • Thread-safe within a single uvent loop
  • Perfect for request fan-out

3. RedisSubscriber (low-level Pub/Sub)

Raw access to Redis subscriptions.

  • Dedicated connection
  • SUBSCRIBE / PSUBSCRIBE / UNSUBSCRIBE
  • Message callbacks
  • Backpressure-safe
  • Supports reconnect logic at connection level

4. RedisBus (high-level resilient pub/sub)

Pub/Sub with failure handling:

  • Automatic reconnect
  • Automatic re-subscribe
  • Periodic PING health checks
  • Unified API for publish/subscribe
  • Good for microservices and event-driven modules

5. Reflection Helpers (RedisReflect)

One-line object mapping to/from Redis Hashes:

  • hset_struct(client, key, obj)

  • hget_struct<T>(client, key)

  • Based on ureflect

  • Supports:

    • optional
    • strings
    • ints/bools
    • nested aggregates (field-flattened)

🔥 Major Infrastructure Features

6. Sentinel Support

Production-ready HA support.

  • Resolve active master from Sentinel:

    • SENTINEL get-master-addr-by-name
  • Auto-retry and failover handling

  • RedisSentinelPool for seamless master reconnection

  • Transparently reconnects after Sentinel-triggered failover

Use cases:

  • Master failover environments
  • Deployments without Redis Cluster
  • Simple HA setups

7. Redis Cluster Client

Full support for Redis Cluster topology.

  • CRC16 slot hashing

  • 16 384-slot routing table

  • Automatic discovery via CLUSTER SLOTS

  • Built-in handling for:

    • MOVED
    • ASK
    • ASKING temporary redirects
  • Lazy connection creation for cluster nodes

  • Automatic slot table rebuild on topology changes

This is a complete drop-in async alternative to hiredis-cluster.


8. Redlock (Distributed Locks)

Implementation of Redis-based distributed locks.

  • Quorum-based lock acquisition (N/2 + 1)

  • TTL + drift correction

  • Safe unlock only by token match

  • Optional:

    • Construction from configs
    • Construction from existing clients/pools
  • Compatible with Sentinel and Cluster topologies

Designed for:

  • leader election
  • distributed task schedulers
  • preventing concurrent job execution

🧩 Internal Components

RESP Parser

  • Incremental
  • Zero-copy where practical
  • Handles nested arrays efficiently

Typed interfaces

  • RedisErrorCategory

  • RedisResult<T>

  • RedisValue with variants:

    • nil
    • string
    • bulk
    • array
    • int

No hiredis

Everything written directly in C++23.


📦 Build & Integrate

  • Zero external runtime deps

  • Only requires:

    • uvent
    • ulog (optional)
    • ureflect (optional)
  • Works on Linux, BSD, macOS

Enable logs:

target_compile_definitions(uredis PUBLIC UREDIS_LOGS)

🚀 Summary

v0.0.1 establishes uRedis as a complete async Redis ecosystem:

  • Core client
  • Connection pool
  • Subscriber + Bus
  • Reflection helpers
  • Sentinel
  • Cluster
  • Redlock

The API is stable, predictable, and suitable for immediate production integration.