Database Redis
ASecurityFor a general-purpose cache, the best default Redis eviction policy is `allkeys-lru`. Why `allkeys-lru` is usually the right choice: - It allows Redis to evict any key when memory is full. - It matches cache-oriented workloads where all cached entries are disposable. - It favors keeping recently used keys in memory, which usually improves hit rate for normal application traffic. Use `allkeys-lru` when: - Redis is being used mainly as a cache - Cached data can be recomputed or reloaded from a ...
- 584 stars
- 0 votes
- 0 copies
- 4 views
- Added September 5, 2026
Security analysis
100/100Pro scans all 11 files and shows the line behind each finding
npx -y skills add HoangNguyen0403/agent-skills-standard --skill database-redis --agent claude-codeAre you the author of Database Redis?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/hoangnguyen0403-database-redis-142f0b2e)For a general-purpose cache, the best default Redis eviction policy is `allkeys-lru`.
Why `allkeys-lru` is usually the right choice:
- It allows Redis to evict any key when memory is full.
- It matches cache-oriented workloads where all cached entries are disposable.
- It favors keeping recently used keys in memory, which usually improves hit rate for normal application traffic.
Use `allkeys-lru` when:
- Redis is being used mainly as a cache
- Cached data can be recomputed or reloaded from a durable database
- You want memory pressure handled automatically without relying on every key having a TTL
When not to use it:
- If Redis contains a mix of persistent keys and expiring cache keys, `volatile-lru` is often safer because only keys with TTLs are eligible for eviction.
- If critical state exists only in Redis, that is a design problem. Eviction policy should not be your protection for important data.
Practical guidance:
- Even with `allkeys-lru`, still set TTLs on ephemeral cache keys whenever practical.
- Add small TTL jitter for high-volume caches to avoid synchronized expiration bursts.
- Monitor cache hit ratio and eviction count after rollout. If hit rate is poor or evictions spike unexpectedly, revisit key size, TTL strategy, and memory sizing.
Operational reminder:
- Eviction policy is not a substitute for good key design.
- Keep values bounded in size.
- Avoid unbounded read patterns.
- Make sure Redis is supporting a durable primary database, not replacing it.
In short: choose `allkeys-lru` for a normal general cache, and choose `volatile-lru` instead only when Redis is serving a mixed workload with both persistent and expiring keys.
Files in this skill
- eval-1.baseline.md
- eval-1.with-skill.md
- eval-2.baseline.md
- eval-2.with-skill.md
- eval-3.baseline.md
- eval-3.with-skill.md
- trigger-1.md
- trigger-2.md
- trigger-3.md
- trigger-4.md
Attribution
Related skills
View all in development →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.