Read-through وwrite-through
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
know the patterns where the cache layer loads and writes data itself.
الموضوعات المخطط لها
- Read-through: the caller asks the cache; the cache loads from the database on a miss (Caffeine
LoadingCache, Spring@Cacheablebehave like this). - Write-through: a write goes to the cache and the database synchronously, in one operation.
- Benefit: one code path and a cache that is always up to date after writes.
- Failure: write-through is as slow as the slower store and needs a plan if one write fails; the two stores can diverge without a transaction.
تفاصيل المخطط المبدئي
عرض عملي
diagram: app → cache layer → database for both read and write; compare to cache-aside where the app talks to both.
اختبر فهمك
Who loads data on a miss in read-through?
أظهر الإجابة
The cache layer, not the caller.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.