A cache stores values for reuse, a buffer smooths throughput between producer and consumer, memoization is a cache applied to a function's return value.
Aspect | Cache | ||
|---|---|---|---|
Purpose | Faster reads | Smooth throughput | Faster repeated calls |
Unit | Key/value | Bytes stream | Function + arguments |
Lives in | Every layer | I/O boundary | Function scope |
Eviction | LRU, TTL, FIFO | Implicit (drain) | Usually unbounded |
Classic example |
| Fibonacci cache |