skills/caching-strategy/SKILL.md
Implement efficient caching strategies using Redis, Memcached, CDN, and cache invalidation patterns. Use when optimizing application performance, reducing database load, or improving response times.
npx skillsauth add aj-geddes/useful-ai-prompts caching-strategyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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 |
development
Implement Zero Trust security model with identity verification, microsegmentation, least privilege access, and continuous monitoring. Use when building secure cloud-native applications.
development
Prevent Cross-Site Scripting (XSS) attacks through input sanitization, output encoding, and Content Security Policy. Use when handling user-generated content in web applications.
tools
Create wireframes and interactive prototypes to visualize user interfaces and gather feedback early. Use tools and techniques to communicate design ideas before development.
development
Implement real-time bidirectional communication with WebSockets including connection management, message routing, and scaling. Use when building real-time features, chat systems, live notifications, or collaborative applications.