⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
Cache-aside (Lazy loading)
Cache
Database
App
-
read cache
-
cached data
-
cache miss: read from DB
-
DB data
-
update cache
- simple implementation, app logic handles cache updating
- more granular control what is cached
- data can be stale if not updating (cache validation)
- most popular choice
- simply and granular control (by application logic)
- resilience to cache failure => use cache-aside for reads and write-through-invalidation for writes
Read-through (Cache handles data retrieval from DB)
Cache
Database
App
- simple application code (cache handles data retrieval)
- ensure data consistency
- increase complexity (data formatting, …) and more data is loaded on cache
- data can be stale
- suitable for CDN?
-
read cache
-
cache miss: read from DB
-
DB data
-
cache data
Write-around
- data is written to DB directly (bypass cache) -> write-heavy workload
- fastest write mechanism
- data in cache may be stale -> not use
App
Cache
Database
-
write to DB
-
read cache
-
cache data (stale)
-
cache miss: read DB data
Write-back
- data is written to cache and sync to DB later -> reduces writes but risks data loss -> write-heavy apps (slight data loss is acceptable), NOT FOR TRANSACTIONS
- faster write mechanism -> reduces load on DB
- data may be not consistency
App
Cache
Database
-
write cache
-
sync to DB
Write-through
- data is written to both cache and DB simultaneously (increase write latency) -> write to DB and delete cache
- data is consistency between cache and DB
App
Cache
Database
-
write/invalidate cache
-
write to DB