Official Python Client for Redis Database
High-performance Python Redis client with clustering, pipelines, and async operation support.
Learn more about redis-py
redis-py is the official Python client library for Redis, providing both synchronous and asynchronous interfaces to interact with Redis servers. It supports all Redis commands and features including clustering, pub/sub messaging, Lua scripting, transactions, pipelines, and connection pooling. The library offers robust error handling, automatic reconnection capabilities, and comprehensive support for Redis data structures like strings, hashes, lists, sets, sorted sets, streams, and geospatial indexes. Built with performance in mind, it includes native support for connection multiplexing, response parsing optimization, and both standalone and cluster deployment modes. redis-py serves as the foundation for Python applications requiring fast in-memory caching, session management, real-time analytics, message queuing, and distributed locking mechanisms.
Complete Redis Command Coverage
Implements the full Redis command set with native Python data type mappings, automatically handling serialization and deserialization. Supports all modern Redis features including Redis Streams, JSON, Search, TimeSeries, and Graph modules. Regular updates ensure compatibility with the latest Redis versions and new commands as they're released.
Async and Sync APIs
Provides both synchronous and asynchronous client implementations, enabling developers to choose the best approach for their application architecture. The async client leverages Python's asyncio for non-blocking I/O operations, perfect for high-concurrency applications, while the sync client offers simplicity for traditional blocking workloads.
Production-Ready Clustering Support
Features built-in Redis Cluster support with automatic node discovery, hash slot calculation, and failover handling. Includes connection pooling, retry logic, and intelligent request routing across cluster nodes. Handles cluster topology changes transparently, making it ideal for scaling Redis deployments horizontally in production environments.
import redis
r = redis.Redis(host='localhost', port=6379, decode_responses=True)
r.set('user:1000:name', 'Alice Johnson')
name = r.get('user:1000:name')
r.setex('session:abc123', 3600, 'active')
ttl = r.ttl('session:abc123')This release introduces experimental health check policies and improves MultiDBClient functionality with better logging and configuration changes.
- –Added initial health check policies, refactored add_database method
- –Disabled SCH in MultiDBClient underlying clients by default
- –Added logging for MultiDBClients
Redis-py v7.1.0 adds new Redis commands (MSETEX, XREADGROUP CLAIM), experimental CAS/CAD and HYBRID search support, drops Python 3.9 support.
- –Adding MSETEX command support.
- –Adding CLAIM option to XREADGROUP command + unit tests
- –Apply routing and response aggregation policies in OSS Cluster mode
- –Adding support for CAS/CAD commands.
- –Adding support for HYBRID search.
This release focuses on improving documentation for the multi-database client functionality with various documentation updates and additions.
- –Add 'multi_database' section to documentation index
- –Revised multi-database client documentation
- –Adding info about Multi-database client in README.md
Top in Backend & APIs
Related Repositories
Discover similar tools and frameworks used by developers
Supabase
PostgreSQL backend with auto-generated APIs and real-time subscriptions.
Magento 2
Modular PHP platform for self-hosted ecommerce storefronts.
Dragonfly
In-memory data store with Redis/Memcached API compatibility and multi-threaded C++.
Node.js
JavaScript runtime built on V8 for server-side development.
ERPNext
Full-featured ERP system built on Frappe Framework.