JetBrains: Don't let file cache grow too large on the JS side
Created by: vdavid
Context
We currently use caching in blob.ts
when loading file content for the "Find on Sourcegraph" popup.
This is neat because we optimize network use this way.
We never flush this cache.
Problem
The cache can grow to an arbitrary size, and waste/use up the user's memory.
Solution
Ideas:
- Items that are older than X minutes (30 minutes?) could be removed from the cache.
- We could track the cache size and start purging the oldest or the largest items if we hit a limit. It'd be extra neat if we could get the amount of memory that the user allows for the IDE, and perhaps even get stats from the IDE on current memory use, and work with that limit dynamically.
- Doing a purge could happen at each cache read (or write), via a repeating timer, or both.