Least Frequently Used (LFU) Cache in Pythonic Art

Mohammed Zaheeruddin Malick
1 min readDec 23, 2019

--

Double Maps and a Double Linked List implementation of a classic cache management Algorithm in Python.

Part II of the Holiday Coding Series — Happy Holidays!

Part I (LRU Cache): https://medium.com/@mohammedzu/least-recently-used-lru-cache-in-pythonic-art-bda8a62fce36

A Least Frequently Used Cache (LFU) evicts the least frequently used key, value tuple when the cache is full, to do so the frequency of each key is updated on each access, a map of frequencies pointing to a double linked list keeps track of all items having the same access frequency.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mohammed Zaheeruddin Malick
Mohammed Zaheeruddin Malick

Written by Mohammed Zaheeruddin Malick

Tireless Learner | Geek | Father of two budding Women leaders!

No responses yet

Write a response