caching-patterns
Redis caching strategies, cache invalidation, write-through/write-behind, TTL management, and cache stampede protection.
npx skills add vibeeval/vibecosystem --skill caching-patterns --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Caching Patterns Redis-based caching strategies for reducing latency and database load. ## Cache Key Design ```typescript // Namespace:entity:id format const CacheKeys = { market: (id: string) => `market:v1:${id}`, marketList: (filters: string) => `market:list:${filters}`, user: (id: string) => `user:v1:${id}`, userMarkets: (userId: string, page: number) => `user:${userId}:markets:${page}`, leaderboard: () => 'leaderboard:v1:global' } // Version prefix allows instant cache bust on schema change: // bump v1 → v2 to invalidate all market keys without scanning ``` ## Cache-Aside (Lazy Loading) ```typescript import Redis from 'ioredis' const redis = new Redis(process.env.REDIS_URL!) const DEFAULT_TTL = 300 // 5 minutes async function getOrSet<T>( key: string, loader: () => Promise<T>, ttl = DEFAULT_TTL ): Promise<T> { const cached = await redis.get(key) if (cached) return JSON.parse(cached) as T const value = await loader() await redis.setex(key, ttl, JSON.stringify(value)) return value } // Usage async function getMarket(id: string): Promise<Market> { return getOrSet( CacheKeys.market(id), () => db.market.findUniqueOrThrow({ where: { id } }), 300 ) } ``` ## Write-Through Pattern ```
- Cache Key Design
- Cache-Aside (Lazy Loading)
- Write-Through Pattern
- Write-Behind (Write-Back) Pattern
- Cache Stampede Protection
- Multi-Level Caching (L1 Memory + L2 Redis)
- Event-Based Cache Invalidation
- Cache Warming
- Monitoring Cache Health
- Common Pitfalls
What does the caching-patterns skill do?
Redis caching strategies, cache invalidation, write-through/write-behind, TTL management, and cache stampede protection.
How do I install it?
Run `npx skills add vibeeval/vibecosystem --skill caching-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From vibeeval/vibecosystem, a repository with 521 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
