Hi all,
I have some C++ code where I need to implement cache replacement using LRU technique.
So far I know two methods to implement LRU cache replacement:
- Using timeStamp for each time the cached data is accessed and finally comparing the timeStamps at time of replacement.
- Using a stack of cached items and moving them to the top if they are accessed recently, so finally the bottom will contain the LRU Candidate.
So, which of these is better to be used in production code?
Are their any other better methods?