jeremylongshore/claude-code-plugins-plus-skills
database-cache-layer
plugins/database/database-cache-layer/skills/implementing-database-caching/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/database/database-cache-layer/skills/implementing-database-caching/SKILL.md -a claude-code --skill implementing-database-cachingInstallation paths:
.claude/skills/implementing-database-caching/# Database Cache Layer This skill provides automated assistance for database cache layer tasks. ## Prerequisites Before using this skill, ensure: - Redis server available or ability to deploy Redis container - Understanding of application data access patterns and hotspots - Knowledge of which queries/data benefit most from caching - Monitoring tools to measure cache hit rates and performance - Development environment for testing caching implementation - Understanding of cache invalidation requirements for data consistency ## Instructions ### Step 1: Analyze Caching Requirements 1. Profile database queries to identify slow or frequently executed queries 2. Determine which data is read-heavy vs write-heavy 3. Identify data that can tolerate eventual consistency 4. Calculate expected cache size and Redis memory requirements 5. Document current database load and target performance metrics ### Step 2: Choose Caching Strategy 1. **Cache-Aside (Lazy Loading)**: Application checks cache first, loads from DB on miss - Best for: Read-heavy workloads, unpredictable access patterns - Pros: Only caches requested data, simple to implement - Cons: Cache misses incur database hit, stale data possible 2. **Write-Through**: Application writes to cache and database simultaneously - Best for: Write-heavy workloads needing consistency - Pros: Cache always consistent, no stale data - Cons: Write latency, unnecessary caching of rarely-read data 3. **Write-Behind (Write-Back)**: Application writes to cache, async writes to database - Best for: High write throughput requirements - Pros: Low write latency, batched database writes - Cons: Risk of data loss, complexity in implementation ### Step 3: Design Cache Architecture 1. Set up Redis as distributed cache layer (L2 cache) 2. Implement in-memory LRU cache in application (L1 cache) 3. Configure CDN for static assets (images, CSS, JS) 4. Design cache key naming convention (e.g., `user:123:profile`) 5. Define