Skip to content
Back to skills

Database Redis

ASecurity

Optimize Redis as cache and coordination infrastructure with TTL, eviction, and latency-aware key design. Use when implementing Redis caching, key invalidation, or Redis performance work.

  • 549 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 6, 2026
developmentgitdatabaseperformance

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 21, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill database-redis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Redis?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Database Redis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-database-redis/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-database-redis)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: database-redis
description: Optimize Redis as cache and coordination infrastructure with TTL, eviction, and latency-aware key design. Use when implementing Redis caching, key invalidation, or Redis performance work.
metadata:
  triggers:
    files:
    - '**/*.ts'
    - '**/*.js'
    - '**/redis.config.ts'
    keywords:
    - redis
    - cache
    - ttl
    - eviction
  upstream:
    - name: redis
      source: github
      repo: redis/redis
      pinned: "7.4.0"
      tag_pattern: "^(\\d+\\.\\d+\\.\\d+)$"
      reviewed: "2026-06-17"
---
# Redis Best Practices

## **Priority: P0 (CRITICAL)**

Redis is fast only when key shape, TTL ownership, and command complexity are explicit.

## Rules

- Namespace keys by product/domain and entity.
- Give cache keys a TTL or a documented reason not to expire.
- Pick eviction policy to match workload: `allkeys-lru` for general caches, `volatile-lru` for mixed persistent/ephemeral data. Monitor hit rate and evictions.
- Avoid slow or unbounded commands in hot paths; prefer `SCAN` over `KEYS` and `UNLINK` over `DEL` for large-key deletion. `lazyfree` settings help background reclamation.

## Verify

- [ ] Key naming identifies owner and invalidation scope.
- [ ] TTL or eviction policy exists for non-durable data.
- [ ] Large reads use bounded range/scan patterns.
- [ ] Connection timeouts and pool settings are explicit.
- [ ] Critical state does not exist only in Redis.

## Anti-Patterns

- **No sole truth in Redis**: Always persist critical data to durable primary database.
- **No large blobs**: Split values > 100KB into smaller keys or use Hashes for field access.
- **No JSON for objects**: Use `HSET` for object fields to enable O(1) access without full decode.
- **No TTL-less keys**: Set TTL or eviction policy on all non-permanent keys to prevent unbounded growth.
- **No `KEYS` in app paths**: use `SCAN` or explicit index keys.

## References

- [Framework Map](../references/framework-map.md)
- [Best Practices Guide](references/best-practices.md)
- [Checklist](references/checklist.md)

## Canonical response anchors

When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- lazyfree

Files in this skill

  • SKILL.md2.4 KB
  • evals/evals.json1.8 KB
  • references/best-practices.md2.7 KB
  • references/checklist.md1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.