UploadStagingCache implements Closeable { protected void invalidate(String key) { if (!attic.containsKey(key) && map.containsKey(key)) { try { LOG.debug("Invalidating [{}]", key); File toBeDeleted = map.get(key); deleteInternal(key, toBeDeleted); map.remove(key, toBeDeleted); } catch (IOException e) { LOG.warn("Could not delete file from staging", e); } } } private  UploadStagingCache(File dir, File home, int uploadThreads, long size /* bytes */,
        StagingUploader uploader, @Nullable FileCache cache, StatisticsProvider statisticsProvider,
        @Nullable ListeningExecutorService executor,
        @Nullable ScheduledExecutorService scheduledExecutor,
        int purgeInterval /* secs */, int retryInterval /* secs */); private  UploadStagingCache(); static UploadStagingCache build(File dir, File home, int uploadThreads, long size
        /* bytes */, StagingUploader uploader, @Nullable FileCache cache,
        StatisticsProvider statisticsProvider, @Nullable ListeningExecutorService executor,
        @Nullable ScheduledExecutorService scheduledExecutor, int purgeInterval /* secs */,
        int retryInterval /* secs */); Optional<SettableFuture<Integer>> put(String id, File input); @Nullable File getIfPresent(String key); DataStoreCacheStatsMBean getStats(); @Override void close();  }
@Test public void testInvalidateNoAdd() throws Exception { stagingCache.invalidate(ID_PREFIX + 0); assertCacheStats(stagingCache, 0, 0, 0, 0); }
@Test public void testInvalidate() throws Exception { List<ListenableFuture<Integer>> futures = put(folder); stagingCache.invalidate(ID_PREFIX + 0); File file = stagingCache.getIfPresent(ID_PREFIX + 0); assertNull(file); taskLatch.countDown(); callbackLatch.countDown(); waitFinish(futures); assertCacheStats(stagingCache, 0, 0, 1, 1); file = stagingCache.getIfPresent(ID_PREFIX + 0); assertNull(file); }