Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

pi/agent/skills/optimize/references/caching.md

Raw
Rendered preview

Caching

memoization, caching layers, invalidation.

Measure

  • cache profiling → hit/miss rate, size, eviction
  • invalidation analysis → staleness frequency
  • cache overhead → lookup + maintenance cost
  • metrics → hit ratio, avg lookup time, invalidation freq

Optimize

  • multi-level caching → hot (mem) → warm (shared) → cold (backend)
  • cache warming → pre-populate known-accessed data
  • efficient invalidation → TTL, version keys, event-driven
  • cache-aside → application manages; only cache frequent reads
  • write-through vs write-behind → by read/write ratio + consistency needs

Pitfalls

  • cache stampede → concurrent uncached keys overwhelm backend
  • stale data → invalidation missing
  • over-caching → rarely-accessed wastes memory + lookup overhead
  • unbounded cache → evicts or exhausts memory
# Caching

memoization, caching layers, invalidation.

## Measure

- cache profiling → hit/miss rate, size, eviction
- invalidation analysis → staleness frequency
- cache overhead → lookup + maintenance cost
- metrics → hit ratio, avg lookup time, invalidation freq

## Optimize

- multi-level caching → hot (mem) → warm (shared) → cold (backend)
- cache warming → pre-populate known-accessed data
- efficient invalidation → TTL, version keys, event-driven
- cache-aside → application manages; only cache frequent reads
- write-through vs write-behind → by read/write ratio + consistency needs

## Pitfalls

- cache stampede → concurrent uncached keys overwhelm backend
- stale data → invalidation missing
- over-caching → rarely-accessed wastes memory + lookup overhead
- unbounded cache → evicts or exhausts memory