Cache (computing): Difference between revisions

Content deleted Content added
m interwik itp
Operation: add definition of hit rate
Line 9:
A cache is a pool of entries. Each entry has a datum, which is a copy of the datum in some backing store. Each entry also has a tag, which specifies the identity of the datum in the backing store of which the entry is a copy.
 
When the cache client (a CPU, web browser, operating system) wishes to access a datum presumably in the backing store, it first checks the cache. If an entry can be found with a tag matching that of the desired datum, the datum in the entry is used instead. This situation is known as a '''cache hit'''. So, for example, a web browser program might check it's local cache on disk to see if it has a local copy of the contents of a web page at a particular URL. In this example, the URL is the tag, and the contents of the web page is the datum. The percentage of accesses that result in cache hits is known as the '''hit rate''' of the cache.
 
The alternative situation, when the cache is consulted and found not to contain the desired datum, is known as a '''cache miss'''. The datum fetched from the backing store during miss handling is usually inserted into the cache, ready for the next access. If the cache has limited storage, it may have to eject some other entry in order to make room. The [[Heuristic (computer science)|heuristic]] used to select the entry to eject is known as the '''replacement policy'''. One popular replacement policy, [[Cache algorithms|LRU]], replaces the least recently used entry.