LRU Cache implementation

Shivani Mehta
1 min readAug 19, 2020

This article is in continuation of my previous article, where I’ve discussed the theory behind Caching, LRU Cache and its implementation using different data structures. If you haven’t checked it yet, head over to Part 1.

Now in this article, we are going to see how we can design and implement our own LRU cache using our own LinkedList Node class and other one using inbuilt STL library.

Below is the flow of operations:-

This is Class-based implementation of LRU cache.

This is cpp STL based implementation of the same code

Hope you like it.

Happy Coding ‘ )

--

--