Wprowadzenie
<strong>Cache Invalidation (Unieważnianie cache)</strong> to proces usuwania lub oznaczania jako nieaktualne danych przechowywanych w cache, gdy ulegną one zmianie w źródle. Jest uważany za jedno z najtrudniejszych zagadnień w informatyce.
„There are only two hard things in Computer Science: cache invalidation and naming things.”
— Phil Karlton
Problemy z unieważnianiem cache
- <strong>Stale Data</strong> – użytkownik widzi stare dane
- <strong>Cache Stampede / Thundering Herd</strong> – wiele zapytań jednocześnie uderza w bazę po wygaśnięciu cache
- <strong>Over-invalidation</strong> – niepotrzebne czyszczenie cache, spadek wydajności
- <strong>Under-invalidation</strong> – dane nie są aktualizowane
Strategie unieważniania cache
- <strong>Time-based (TTL)</strong> – automatyczne wygaśnięcie po określonym czasie
- <strong>Write-through</strong> – zapis do bazy i cache jednocześnie
- <strong>Write-behind</strong> – zapis asynchroniczny
- <strong>Event-driven Invalidation</strong> – powiadomienie cache po zmianie danych
- <strong>Versioning</strong> – dodawanie numeru wersji do klucza cache
- <strong>Stale-While-Revalidate</strong> (SWR) – popularne w Next.js
- <strong>Cache Tagging</strong> – grupowanie cache i masowe unieważnianie
Cache Invalidation w AI i dużych systemach
- Unieważnianie embeddingów i wektorów po fine-tuningu modelu
- Cache promptów i odpowiedzi LLM
- Cache RAG (Retrieval-Augmented Generation)
- Versioning modeli AI w produkcji
Powiązane pojęcia
Cache→Cache Poisoning→Cache Stampede→Cache Miss→Cache Warming→Cache Aware Attention→Cache Hit Rate→Buffer Cache→Decoder Kv Cache→Embedding Cache→
Dodano: 16 maja 2026