FIFO cache and LRU cache

I'm so sorry for such a simple question. I just want to be sure that I understand the FIFO cache model correctly and hope someone helps me with this :) The LRU cache deletes the entry that was least accessed if the cache is full. FIFO deletes an entry that was added earlier (?) Than other entries if the cache requires free space (for example, if 'a' - 'v' - 'f' - 'k' are entries in the cache, and ' a 'is the oldest entry, then the cache will delete' a 'if it needs free space).

I'm right?

+5
source share
3 answers

You're right.

Think of FIFO when cars go through a tunnel. The first car to go into the tunnel will be the first to go the other way.

Think of the LRU cache as a garage cleanup. You will throw away items that you have not used for a long time, and keep those that you often use. The evolution of this algorithm (an improvement for a simple LRU) is to discard elements that have not been used for a long time, and they should not be replaced if you need them in the end.

+7
source

Yes, the LRU cache is based on the least recent use of an object in the cache, but FIFO is based on the object's caching time.

0
source

Yes this is correct. FIFO means First In, First Out, i.e. It takes into account (in this case delete) the elements strictly in the order of receipt. LRU has been used recently, a cache element that has not been used for the longest time is issued (on suspicion that it will not be needed in the near future).

0
source

All Articles