キャッシングは、頻繁にアクセスされるデータを高速層(通常はメモリ内)に保存し、再計算や遅いソースから再取得することなく素早く取得できるようにします。これはパフォーマンスとスケーラビリティを向上させるための最も重要なテクニックの1つです。
キャッシングの役割
CACHING stores copies of data in a FAST location for quick repeated access:
→ instead of recomputing or re-fetching from a slow source (database, API, computation),
serve from the fast cache
→ DRAMATICALLY faster (cache hit) + REDUCES load on the slow backend
→ trades some staleness/complexity for big performance and scalability gains.
キャッシングが使用される場所(レイヤー)
BROWSER / CLIENT cache → cache on the user's device
CDN → cache static content at edge locations near users
APPLICATION cache (e.g. Redis/Memcached) → cache DB query results, computed data, sessions
DATABASE cache → query/result caching
→ caching can happen at MULTIPLE layers (defense in depth for performance)
