# Redis

> Redis API Skill

- Skill: `ashish7802/redis` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add ashish7802/redis`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ashish7802/redis/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: ashish7802 (https://skillmd.com/u/ashish7802)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/ashish7802/redis

---

# 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
```bash
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
1. `createClient({ url })`.
2. `await client.connect()`.
3. `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
- [API Reference](https://redis.io/commands/)

## 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

