Skip to content
Back to skills

Caching Strategy

ASecurity

Design comprehensive multi-layer caching strategies across CDN, application, and database tiers for maximum performance.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
ai-agentspythongoapidatabaseperformance

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add AtulPurohit/Antigravity-Awesome-Skills --skill caching-strategy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Caching Strategy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Caching Strategy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/atulpurohit-caching-strategy/badge)](https://www.skillsdirectory.com/skills/atulpurohit-caching-strategy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: caching-strategy
description: "Design comprehensive multi-layer caching strategies across CDN, application, and database tiers for maximum performance."
category: architecture
tags: [caching, redis, cdn, performance, strategy]
complexity: advanced
risk: low
compatibility: [claude-code, antigravity, gemini-cli, cursor, copilot, codex-cli, autohand, kiro]
source: antigravity-official
version: "1.0.0"
date_added: "2026-07-10"
last_updated: "2026-07-10"
---

# Caching Strategy Designer

## Purpose
Design and implement caching at every layer to dramatically reduce latency and database load.

## Cache Layers
1. **Browser Cache**: Static assets, API responses with Cache-Control headers
2. **CDN Cache**: Cloudflare/CloudFront for global edge caching
3. **Application Cache**: Redis/Memcached for computed data
4. **Database Cache**: Query result cache, connection pooling

## Cache-Control Headers
```
# Immutable static assets (hash in filename)
Cache-Control: public, max-age=31536000, immutable

# API: cache for 60s, stale-while-revalidate for 5 min
Cache-Control: public, s-maxage=60, stale-while-revalidate=300

# Private user data
Cache-Control: private, no-cache

# Never cache
Cache-Control: no-store
```

## Application Cache Pattern
```python
# Cache-aside with stampede prevention
def get_cached(key: str, ttl: int, fetch_fn: callable):
    if value := cache.get(key):
        return value
    
    # Atomic lock prevents stampede
    with cache.lock(f"lock:{key}", timeout=10):
        # Double-check after acquiring lock
        if value := cache.get(key):
            return value
        value = fetch_fn()
        cache.set(key, value, ttl)
        return value
```

## Invalidation Strategies
- **TTL-based**: Expire after fixed time (simple, may be stale)
- **Event-driven**: Invalidate on data change (accurate, complex)
- **Tag-based**: Group related cache items, flush by tag
- **Cache-busting**: Change URL/key when content changes

## Outputs
1. Caching strategy document
2. Cache-Control header configuration
3. Application cache implementation
4. Invalidation event handlers
5. Cache monitoring metrics

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…