انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-021-L03

ذاكرة المستوى الثاني وذاكرة الاستعلامات المؤقتة

  • الدرس 3 من 6
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

decide whether a cache is worth it.

الموضوعات المخطط لها

  • First-level cache: the persistence context, per transaction; always on.
  • Second-level cache: shared across sessions through a provider (Ehcache, Infinispan, Caffeine via JCache); needs @Cache per entity.
  • Good candidates: read-mostly reference data (countries, categories). Bad: frequently changed or large mutable entities.
  • Query cache stores result ids and is invalidated on any write to the tables involved; rarely a win.
  • Multi-instance deployments need a distributed or invalidating provider; often a dedicated cache (Redis, later modules) is simpler.
  • A cache hides bugs and adds staleness; measure hit ratio before keeping it.
تفاصيل المخطط المبدئي

عرض عملي

a decision table: entity, read/write ratio, staleness allowed, cache yes/no.

اختبر فهمك

Which entity suits a second-level cache: product stock or country list?

أظهر الإجابة

Country list; stock changes constantly.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.