Skip to content

Instantly share code, notes, and snippets.

@ekampf ekampf/cache.py
Last active May 15, 2018

Embed
What would you like to do?
// Implement a cache class that stores given item. The cache is limited to a given `size` and will discard the
// least recently used item if it needs the space.
//
// Clearly document design choices, algorithm and possible optimizations.
// While we require you to implement one memory allocation algorithm,
// also document future looking design considerations.
//
// Implementation Notes:
// * While the interface below is written in Python, feel free to implement the Cache in the language of your choosing.
// * Do not use standard library data structures - write your own. (like Python's `collections` module etc.)
//
// *** Requirements ***
// 1. Working code (obviously).
// 2. Unit tests (using a unit testing library of your choosing)
// 3. Documentation (as describe in the 2nd paragraph above)
//
class Cache(object):
def __init__(self, size):
pass
def get(self, key):
pass
def set(self, key, value):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.