| Cache algorithms are optimizing instructions that a computer program can
follow to manage a cache of information stored on the computer. Cache size is usually
limited, and if the cache is full, the computer (that is, the programmer) must decide which items to keep and which to discard to
make room for new items.
Examples of caching algorithms are:
- LRU (least recently used) discards the least recently used items first. Obviously, this requires keeping track of what was
used when.
- LFU (least frequently used) counts, how often an item is needed. Those that are used least often are discarded first.
Other things to consider:
- Price: keep those items that are expensive to obtain, e.g. those that take a long time to get.
- Size: If items have different sizes, you may want to discard a large one to store several smaller ones.
- Time: Some caches keep information that expires (e.g. a news cache, a DNS cache, or a web browser cache). The computer may
discard items because they are expired. Depending on the size of the cache no further caching algorithm to discard items may be
necessary.
External Links
|