From aj-geddes-useful-ai-prompts-4
Implements caching strategies with Redis, Memcached, and CDN. Covers cache invalidation patterns, TTL management, and multi-level caching for performance optimization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/aj-geddes-useful-ai-prompts-4:caching-strategyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Overview](#overview)
Implement effective caching strategies to improve application performance, reduce latency, and decrease load on backend systems.
Minimal working example:
import Redis from "ioredis";
interface CacheOptions {
ttl?: number; // Time to live in seconds
prefix?: string;
}
class CacheService {
private redis: Redis;
private defaultTTL = 3600; // 1 hour
constructor(redisUrl: string) {
this.redis = new Redis(redisUrl, {
retryStrategy: (times) => {
const delay = Math.min(times * 50, 2000);
return delay;
},
maxRetriesPerRequest: 3,
});
this.redis.on("connect", () => {
console.log("Redis connected");
});
this.redis.on("error", (error) => {
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Redis Cache Implementation (Node.js) | Redis Cache Implementation (Node.js) |
| Cache Decorator (Python) | Cache Decorator (Python) |
| Multi-Level Cache | Multi-Level Cache |
| Cache Invalidation Strategies | Cache Invalidation Strategies |
| HTTP Caching Headers | HTTP Caching Headers |
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin aj-geddes-useful-ai-prompts-4Implements API response caching with Redis, Memcached, cache-aside patterns, TTL, tag-based invalidation, HTTP headers, and stale-while-revalidate for performance optimization.
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.
Provides caching patterns like cache-aside, write-through, stampede prevention, CDN headers, multi-level L1/L2/L3 caches, and invalidation strategies for high-traffic systems and CDN design.