Mechanics behind LRU: 1) DataStructues to be used: 1) HashTable 2) DoublyLinkedList Algorithm: => Cache initial size is 5 How to insert new key,value? HashTable<K, DoublyLinkedList<K,V>> key => key of the pair what we are intend to insert value => doubly linked list of both key and value Check if…