Skip to content

Commit

Permalink
Fix typo in caching docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willcosgrove committed Sep 4, 2024
1 parent 47d099e commit 013c364
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion design/caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ There are a few different approaches to key eviction:
- **Last In First Out (LIFO)** — with this approach, the first keys to be evicted are the ones that were added to the cache last.
- **First In First Out (FIFO)** — with this approach, the first keys to be evicted are the ones that were added to the cache first.

Naievely, the LRU approach seems like the best one. It’s the most fair and it’s the one that’s most likely to keep the most useful keys in the cache. However the bookkeeping overhead to know which keys have been accessed most recently, also makes it slower to access.
Naively, the LRU approach seems like the best one. It’s the most fair and it’s the one that’s most likely to keep the most useful keys in the cache. However the bookkeeping overhead to know which keys have been accessed most recently, also makes it slower to access.

If you think about it, with an LRU cache, you need to keep track of the order in which keys were accessed. That means every read also requires a write, which is more expensive. In order to avoid contention, you would also need to use a `Mutex` to make sure only one thread is accessing the cache at a time.

Expand Down

0 comments on commit 013c364

Please sign in to comment.