/**
  * Remove a file from the cache. Called after it has been removed from its ArchiveHandler.
  *
  * @param item The ArchiveStoreItem to remove.
  */
 synchronized void removeCachedItem(ArchiveStoreItem item) {
   long size = item.spaceUsed();
   storedData.removeKey(item.key);
   // Hard disk space limit = remove it here.
   // Soft disk space limit would be to remove it outside the lock.
   // Soft disk space limit = we go over the limit significantly when we
   // are overloaded.
   cachedData -= size;
   if (logMINOR) Logger.minor(this, "removeCachedItem: " + item);
   item.close();
 }
 public void onFinished(USKFetcher fetcher, boolean ignoreError) {
   USK orig = fetcher.getOriginalUSK();
   USK clear = orig.clearCopy();
   synchronized (this) {
     if (backgroundFetchersByClearUSK.get(clear) == fetcher) {
       backgroundFetchersByClearUSK.remove(clear);
       if (!ignoreError) {
         // This shouldn't happen, it's a sanity check: the only way we get cancelled is from
         // USKManager, which removes us before calling cancel().
         Logger.error(
             this,
             "onCancelled for " + fetcher + " - was still registered, how did this happen??",
             new Exception("debug"));
       }
     }
     if (temporaryBackgroundFetchersLRU.get(clear) == fetcher) {
       temporaryBackgroundFetchersLRU.removeKey(clear);
       temporaryBackgroundFetchersPrefetch.remove(clear);
     }
   }
 }