api-cache-redis
SKILL.md
Redis Cache Service
Purpose
Generate Redis cache service with tenant-prefixed keys to prevent cross-tenant data leakage, TTL management for memory efficiency, and cache invalidation patterns.
When to Use
- Caching frequently accessed data
- Session storage
- Rate limiting
- Reducing database load
- Tenant-isolated caching
What It Generates
Directory Structure
apps/api/src/modules/{feature}/services/
├── {feature}-cache.service.ts
├── {feature}-cache.service.spec.ts
└── index.ts
Patterns Enforced
Tenant-Prefixed Keys
Cache keys use format: tenant:{tenantId}:{key}
- Prevents cross-tenant cache pollution
- Enables tenant-wide cache clearing
- Isolates rate limit counters
TTL Management
- All cache keys have TTL
- Default TTL: 5 minutes (300 seconds)
- Session TTL: 24 hours (86400 seconds)
- No infinite TTL (prevents memory leaks)
Cache Invalidation
- Pattern-based deletion:
delPattern('tenant:{tenantId}:*') - Tag-based invalidation
- Automatic invalidation on updates
Usage Example
/skill cache-redis --name=User --methods='cacheUser,cachePermissions,clearUserCache'
Related Files
- Data Repository - Repository using cache
- BullMQ Queues - Queue jobs with caching
Weekly Installs
1
Repository
rimthan-lab/rim…-pluginsGitHub Stars
1
First Seen
6 days ago
Security Audits
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1