ذاكرة التخزين المؤقت (Caching) تخزن البيانات التي يتم الوصول إليها بشكل متكرر في طبقة سريعة (غالباً في الذاكرة) حتى يمكن استرجاعها بسرعة دون إعادة حساب أو إعادة جلب من مصادر أبطأ. إنها واحدة من أهم التقنيات لتحسين الأداء والقابلية للتوسع.
ما تفعله ذاكرة التخزين المؤقت
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)
