-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat: LFU (Least frequently used) cache #2757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! Let me know if this was for hacktoberfest
Yes, this is for Hacktoberfest. Thank you for reviewing my contribution. |
youre very welcome. lets get this accepted soon 🚀 |
@realstealthninja, what is the reason for making a non member function static? |
Static is used to hide the function from the global namespace. Imo there shouldn't be 3 test function just one with comments delimiting the cases |
Got it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
Description of Change
LFU Cache implementation
In a fixed size cache, when new item is added and the cache is full
The least frequently used element is evicted from the cache
If there are multiple items with the same frequency of usage,
then the least recently used item is evicted.
Checklist
Notes:
added LFU Cache with tests and usage.