From aj-geddes-useful-ai-prompts-4
Implements multi-level query caching strategies using Redis, Memcached, and database-level caching. Covers cache invalidation, TTL strategies, and cache warming patterns for high-read workloads.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:query-caching-strategiesThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Implement multi-level caching strategies using Redis, Memcached, and database-level caching. Covers cache invalidation, TTL strategies, and cache warming patterns.
Minimal working example:
// Node.js example with Redis
const redis = require("redis");
const client = redis.createClient({
host: "localhost",
port: 6379,
db: 0,
});
// Get user with caching
async function getUser(userId) {
const cacheKey = `user:${userId}`;
// Check cache
const cached = await client.get(cacheKey);
if (cached) return JSON.parse(cached);
// Query database
const user = await db.query("SELECT * FROM users WHERE id = $1", [userId]);
// Cache result (TTL: 1 hour)
await client.setex(cacheKey, 3600, JSON.stringify(user));
return user;
}
// Cache warming on startup
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Redis Caching with PostgreSQL | Redis Caching with PostgreSQL |
| Memcached Caching | Memcached Caching |
| PostgreSQL Query Cache | PostgreSQL Query Cache |
| MySQL Query Cache | MySQL Query Cache |
| Event-Based Invalidation | Event-Based Invalidation |
| Time-Based Invalidation | Time-Based Invalidation, LRU Cache Eviction |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Implements caching strategies with Redis, Memcached, and CDN. Covers cache invalidation patterns, TTL management, and multi-level caching for performance optimization.
Implements multi-tier caching with Redis, in-memory caches, and CDN layers using cache-aside patterns, TTLs, and invalidation to reduce database load and improve read performance.
Design multi-layer caching strategies (client, edge, service, database) for performance. Use when optimizing latency or reducing database load.