simplified to using just an array to store LRU cache - thanks to @mrclay