┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Application │──────▶│ Cache │──────▶│ Main Storage │
└───────────────┘ └───────────────┘ └───────────────┘
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
▼ ▼ ▼
Write-through: Write to Cache and Main Storage synchronously
Write-back: Write to Cache first, then asynchronously to Main StorageThis diagram shows the data flow for write-through and write-back caching. The application writes data to the cache, which either immediately writes to main storage (write-through) or delays writing to main storage (write-back).