Redis API Skill
Overview
Redis is used as a database, cache, and message broker. This skill covers the redis (Node.js) and redis-py libraries.
Installation
npm install redis
pip install redis
Authentication
Uses a connection URL redis://user:password@host:port. Redis 6+ supports ACLs (Access Control Lists) for fine-grained permissions.
Core Concepts
- Keys: The string identifier for data.
- TTL (Time to Live): Expiration time for a key.
- Pub/Sub: Publish/Subscribe messaging paradigm.
Common Workflows
createClient({ url }).await client.connect().await client.set('key', 'value', { EX: 3600 }).
Error Handling
Handle connection drops. The Node SDK v4+ automatically reconnects. Catch command errors if passing invalid types (e.g., trying to HGET a string).
Security
Never expose Redis directly to the public internet. Ensure requirepass is set or use managed services like ElastiCache with TLS.
Rate Limits
Redis is bound by CPU and Memory, not API limits. It handles 100,000+ operations per second easily.
Best Practices
Always set a TTL (EX or PX) on cache keys to prevent memory exhaustion (OOM). Use pipelining (client.multi()) to batch commands and reduce RTT latency.
Troubleshooting
If memory fills up, verify your eviction policy (maxmemory-policy) is set to allkeys-lru or volatile-lru rather than noeviction.
References
Why use this skill
Use this when your agent works with redis — structured patterns beat pasted docs and prevent common hallucinations.
AI pitfalls
- Inventing column names or schema fields
- Using deprecated driver methods or wrong connection strings
- Omitting connection pooling or transaction boundaries
Production checklist
- Migrations version-controlled and applied via CI
- Connection limits and pooling configured
- Backups and restore procedure documented
Related skills
- No graph relationships yet — see the knowledge graph in the docs site.
Last Verified: 2026-07-02