LRU and LFU cache implementation | Lxming's Weblog
I am learning a couple of LRU/LFU cache implementation. In a couple of implementations, I saw the combination of deque, double-linked list and hashmap data structure, the idea is like:
in LRU cache:
use hashmap to achieve a O(1) lookup.
use deque to maintain order by access.
in LFU cache:
use hashmap to achieve a O(1) lookup.
use double-linked list to maintain frequency
Read full article from LRU and LFU cache implementation | Lxming's Weblog
No comments:
Post a Comment