vanillaes/computer-science

LRU Cache

evanplaice opened this issue · 1 comments

Implement a LRU (Least Recently Used) Cache

Checklist

  • implementation
  • tests
  • jsdoc

Specifics

  • the cache has a fixed capacity defined during creation
  • put(key, value) adds an item to the top of the stack
  • put(key, value) when the capacity is exceeded the bottom item is removed
  • get(key) returns the value of item[key]
  • get(key) moves the item to the top of the stack
  • put(key, value) mutates the value if it already exists on the stack

Notes

References

Added in v0.11