LRU cache in TypeScript, adapted from https://github.com/rsms/js-lru