Can't you just call addFileToCache() for both cases?