Files
CleanArchitecture-template/base/.agent/rules/Redis.md
2026-03-09 18:01:01 +07:00

12 lines
554 B
Markdown

---
trigger: always_on
---
# Redis Rules
- **Format:** `{app}:{layer}:{entity}:{action}:{id}` (e.g., `app:cache:user:123`)
- **Rules:** All lowercase, separated by colons `:`, max 50 chars.
- **Mandatory TTL:** Every key MUST have an expiration time to avoid memory leaks.
- **Commands:** Use `SCAN`, `HSCAN`, `SSCAN`. NEVER use `KEYS *` (blocks server).
- **Structures:** Use `Hash` for objects, `String` for simple values/JSON, `Set`/`List` for collections.
- **Invalidation:** Use tags (e.g., `app:tags:user`) to group and delete related cache keys.