# Dialog Cache - FikoYT

## 📦 Component Cache

**Dialog lifecycle:**
- **Open:** Component oluştur/gizle
- **Close:** DOM'de gizle (destroy değil)
- **Reuse:** State korunur

## 🔧 Cache Pattern

```typescript
// Component cache
private dialogCache: Map<string, ComponentRef> = new Map();

// Aç
const existing = cache.get(componentType);
if (existing) {
  // Mevcut component'i göster
  existing.instance.show();
} else {
  // Yeni component oluştur
  const ref = createComponent(componentType);
  cache.set(componentType, ref);
}
```

## ⚡ Avantajları

- **Performance:** Component creation yok
- **State:** Form verileri korunur
- **Speed:** Anında açılış
- **Memory:** Optimize edilmiş

## 🗑️ Cache Cleanup

```typescript
// Manuel temizlik
dialogCache.clear();

// Component bazlı
cache.delete(componentType);

// Zaman bazlı
setTimeout(() => cache.clear(), 3600000);
```

## ⚠️ Notlar

- **State:** Automatic preservation
- **Memory:** Manual cleanup
- **Forms:** Data preserved
- **Performance:** Fast switching

---
2025-11-06