Skip to content
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

Implemented LRU Cache Data Structure #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

strobelo
Copy link

@strobelo strobelo commented Oct 21, 2018

Description of new feature, or changes

Introduces a class (LRUCache) which implements a least-recently-used cache data structure. LRU cache is most commonly known for its popularity in operating systems applications for managing system memory caches.

This implementation accepts entries as key-value pairs. If a new entry would exceed the cache's configured maximum size, the least recently retrieved items are removed and destroyed from memory until there is enough room for the new one.

By default, items are considered to have size 1. However, you can specify a custom size function for how big to consider items. For example, if you are storing strings in your cache with a maximum limit of 20, you could specify that the cache should consider the string's length as its size, you would effectively have a cache with a maximum size of 20 bytes.

Checklist

  • Your branch is up-to-date with the base branch
  • You've included at least one test if this is a new feature
  • All tests are passing

Related Issues and Discussions

Implements #17

People to notify

@manrajgrover

@manrajgrover manrajgrover self-requested a review October 22, 2018 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant