Skip to content

Cache design guide covering Redis, Memcached, CDN, and invalidation patterns for faster responses and lower database load.

CCM score
37 of 100
skills.sh installs
552
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers caching for database queries, API responses, expensive computations, session storage, and CDN-served static assets
  • Includes a Node.js Redis cache service and a Python cache decorator, plus multi-level cache and HTTP caching header guides
  • Documents invalidation strategies and enforces a do and don't list: cache-aside reads, TTL tuning, stampede prevention, and graceful degradation
  • Designed for teams that already see slow responses or heavy database load and need to add distributed caching

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill caching-strategy -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Caching Strategy

Table of Contents

Overview

Implement effective caching strategies to improve application performance, reduce latency, and decrease load on backend systems.

When to Use

  • Reducing database query load
  • Improving API response times
  • Handling high traffic loads
  • Caching expensive computations
  • Storing session data
  • CDN integration for static assets
  • Implementing distributed caching
  • Rate limiting and throttling

Quick Start

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");
    });

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
Backend & APIs, Databases
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258

Similar to Caching Strategy

More Backend & APIs