Using LRU cache https://www.npmjs.com/package/lru-cache would handle the duration and allow for more complex cache eviction policies.
Seems like a no brainer to me UNLESS you are trying to keep zero dependencies - which is a valid desire. In that case, I would recommend having dependency injection of a cache which would allow for this without complication.