Files
004_comission/siutinchu/ENGG1330-Computer-Programming-I
louiscklaw 7e9b533da2 update,
2025-01-31 21:05:22 +08:00
..
2025-01-31 21:05:22 +08:00
2025-01-31 21:05:22 +08:00
2025-01-31 21:05:22 +08:00
2025-01-31 21:05:22 +08:00
2025-01-31 21:05:22 +08:00
2025-01-31 21:05:22 +08:00

A LRU cache is a special kind of cache that defines the way of evicting item from the cache when it is full. Its policy is to evict the least recently used item.

For example,

  • a cache having capacity of 4 and is currently storing [[1, '101'], [2, '102'], [3, '103'], [4, '104']],
    • where the 1st (leftmost) item [1, '101'] is the least recently used and
    • the last (rightmost) item [4, '104'] is the most recently used.
    • When the item [2, '102'] is accessed,
    • When another item [10, '110'] is pushed into the cache,