Skip to content

Conversation

@uvdn7
Copy link
Contributor

@uvdn7 uvdn7 commented Feb 9, 2015

I think it's wrong to return any value if the key doesn't exist in the cache since there's no good way to differentiate it from the actual value stored in cache.

* Instead of returning '-1', which can be the actual value being stored,
  raises :class:`KeyError` when key doesn't exist in cache.

* Added docstrings for :class:`LRUCache`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add blank line.

@kunalparmar
Copy link

Can we use an existing library for LRU cache instead of rolling our own? Example, https://pypi.python.org/pypi/pylru/, https://pypi.python.org/pypi/cachetools/.

@uvdn7
Copy link
Contributor Author

uvdn7 commented Feb 9, 2015

@kunalparmar We can do that in a separate commit.

Jeff-Meadows added a commit that referenced this pull request Feb 10, 2015
Improved the LRUCache class and added dostrings
@Jeff-Meadows Jeff-Meadows merged commit 056042a into master Feb 10, 2015
@jmoldow jmoldow deleted the lru_cache branch February 11, 2015 02:27
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.

4 participants