caching-strategy
Implement efficient caching strategies using Redis, Memcached, CDN, and cache invalidation patterns. Use when optimizing application performance, reducing database load, or improving response times.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o caching-strategy.zip https://jpskill.com/download/21354.zip && unzip -o caching-strategy.zip && rm caching-strategy.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21354.zip -OutFile "$d\caching-strategy.zip"; Expand-Archive "$d\caching-strategy.zip" -DestinationPath $d -Force; ri "$d\caching-strategy.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
caching-strategy.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
caching-strategyフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 7
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
キャッシュ戦略
目次
概要
効果的なキャッシュ戦略を実装して、アプリケーションのパフォーマンスを向上させ、レイテンシーを削減し、バックエンドシステムの負荷を軽減します。
使用する場面
- データベースクエリの負荷を軽減する
- API応答時間を改善する
- 高いトラフィック負荷を処理する
- コストのかかる計算結果をキャッシュする
- セッションデータを保存する
- 静的アセットのCDN統合
- 分散キャッシュを実装する
- レート制限とスロットリング
クイックスタート
最小限の動作例:
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)
リファレンスガイド
references/ ディレクトリ内の詳細な実装:
| ガイド | 内容 |
|---|---|
| Redis Cache Implementation (Node.js) | Redisキャッシュの実装 (Node.js) |
| Cache Decorator (Python) | キャッシュデコレーター (Python) |
| Multi-Level Cache | マルチレベルキャッシュ |
| Cache Invalidation Strategies | キャッシュ無効化戦略 |
| HTTP Caching Headers | HTTPキャッシュヘッダー |
ベストプラクティス
✅ DO
- 適切なTTL値を設定する
- 重要なデータに対してキャッシュウォーミングを実装する
- 読み取りにはキャッシュアサイドパターンを使用する
- キャッシュヒット率を監視する
- キャッシュ障害時にグレースフルデグラデーションを実装する
- 大きなキャッシュ値には圧縮を使用する
- キャッシュキーを適切に名前空間化する
- キャッシュスタンピード防止を実装する
- 分散キャッシュには一貫性のあるハッシュを使用する
- キャッシュメモリ使用量を監視する
❌ DON'T
- 何でもかんでも無差別にキャッシュする
- 貧弱なデータベース設計の修正としてキャッシュを使用する
- 暗号化せずに機密データを保存する
- キャッシュミス処理を忘れる
- 頻繁に変更されるデータに対してTTLを長すぎに設定する
- キャッシュ無効化戦略を無視する
- 監視なしにキャッシュする
- 大きなオブジェクトを考慮せずに保存する
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
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");
});
this.redis.on("error", (error) => {
// ... (see reference guides for full implementation)
Reference Guides
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 |
Best Practices
✅ DO
- Set appropriate TTL values
- Implement cache warming for critical data
- Use cache-aside pattern for reads
- Monitor cache hit rates
- Implement graceful degradation on cache failure
- Use compression for large cached values
- Namespace cache keys properly
- Implement cache stampede prevention
- Use consistent hashing for distributed caching
- Monitor cache memory usage
❌ DON'T
- Cache everything indiscriminately
- Use caching as a fix for poor database design
- Store sensitive data without encryption
- Forget to handle cache misses
- Set TTL too long for frequently changing data
- Ignore cache invalidation strategies
- Cache without monitoring
- Store large objects without consideration
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (2,889 bytes)
- 📎 references/cache-decorator-python.md (2,429 bytes)
- 📎 references/cache-invalidation-strategies.md (1,912 bytes)
- 📎 references/http-caching-headers.md (2,032 bytes)
- 📎 references/multi-level-cache.md (2,365 bytes)
- 📎 references/redis-cache-implementation-nodejs.md (5,193 bytes)
- 📎 scripts/validate-api.sh (440 bytes)