Giriş
Yöntemler şöyle. Her bir yöntemin kendine göre consistency (tutarlılık) getirisi ve götürüsü varÇoğu uygulamada %80 Cache-Aside + Eviction yeterli. Ölçeklenmesi gereken sistemlerde şu örüntülere de gerek var.
1. Stampede protection
2. Two-level cache
3. Event invalidation
4. Read-Repair
5. Refresh-Ahead
Spring şunları destekliyor:
1. Cache-Aside (natively)
2. Partial Write-Through
3. Eviction patterns
4. Negative Caching Control
Eğer daha gelişmiş yöntemleri gerekiyorsa, mecburen cache sağlayıcının API'lerini kullanmak gerekiyor.
Okuma Ağırlıklı Yöntemler
1. Cache-aside
App checks cache first.
If missing, fetch DB and update cache.
Best for: read-heavy systems.
2. Read-Through : Implemented by Cache Provider
App reads from cache.
Cache itself loads from DB if missing.
Best for: simpler app logic.
1. Write-Through : Implemented by Cache Provider
Write goes to cache and DB together.
Best for: strong consistency needs.
2. Write-Behind aka Write Back : Implemented by Cache Provider
Write to cache first, DB later.
Best for: high write throughput.
Risk: data loss if not handled well.
3. Write-Around : Implemented by App
Hiç yorum yok:
Yorum Gönder