Consider LRU caching for files you download from remote servers. Basic idea is that you have a configurable storage limit for all downloaded files and you keep track when each of them was last accessed. When downloading a new file would exceed the limit, you delete oldest files until there is enough space.