DEV Community

William Rodriguez
William Rodriguez

Posted on

WRedis v1.0.0 LTS: Enterprise Redis architecture with true async/await and cache decorators

Interacting with Redis in Python often means juggling raw commands, untyped returns, thread-safety pitfalls, and reinventing distributed locks and caching loops across multiple services.

WRedis v1.0.0 LTS is a battle-tested, production-ready Python library built for enterprise workloads with native async/await, declarative cache decorators, comprehensive Sentinel/Cluster high availability, and 95%+ test coverage.


Core Engineering Capabilities

  • Dual Sync & Async APIs: Real asyncio execution with zero background worker threads.
  • Declarative Cache Decorators: @cache and @async_cache with hit/miss telemetrics and custom TTL policies.
  • High Availability Out of the Box: Native Redis Sentinel failover and Redis Cluster topology support.
  • Strict Typing: 100% type annotations compatible with strict mypy configurations.
  • 12 Managed Data Structures: Bitmaps, Hashes, Sets, SortedSets, Streams, Queues, Pub/Sub, Geo, HyperLogLog, Pipelines, and Atomic Transactions.
  • Hardened Test Suite: 800+ unit tests, 38 live integration tests against real Redis instances, and 19 concurrency stress tests.

Production Implementation: Clean Hash Management

from wredis.hash import RedisHashManager

# Connect to Redis
hash_mgr = RedisHashManager(host="localhost", port=6379, db=0)

# Write structured dictionary with automatic JSON serialization
hash_mgr.create_hash(
    hash_name="user_session:1001",
    key="profile",
    value={"name": "Alice", "role": "admin", "active": True},
    ttl=3600
)

# Read with automatic JSON deserialization
profile = hash_mgr.read_hash("user_session:1001", "profile")
print(f"User: {profile['name']} ({profile['role']})")
Enter fullscreen mode Exit fullscreen mode

Production Implementation: Bitmaps for Real-Time Analytics

from wredis.bitmap import RedisBitmapManager

bitmap = RedisBitmapManager(host="localhost")

# Set user activity bit (e.g. user ID 42 logged in today)
bitmap.set_bit(key="active_users:2026-09-19", offset=42, value=1, ttl=86400)

# Fast O(1) bit count
total_active = bitmap.count_bits("active_users:2026-09-19")
print(f"Total active users: {total_active}")
Enter fullscreen mode Exit fullscreen mode

Installation & Source Code

pip install wredis
Enter fullscreen mode Exit fullscreen mode

Author: William Steve Rodríguez Villamizar (Wisrovi)

Top comments (0)