CompositeDataStoreCache extends AbstractCache<String, File> implements Closeable { public File get(String key) throws IOException { try { File staged = stagingCache.getIfPresent(key); if (staged != null && staged.exists()) { return staged; } return downloadCache.get(key); } catch (IOException e) { LOG.error("Error loading [{}] from cache", key); throw e; } } CompositeDataStoreCache(String path, File home, long size, int uploadSplitPercentage,
        int uploadThreads, CacheLoader<String, InputStream> loader, final StagingUploader uploader,
        StatisticsProvider statsProvider, ListeningExecutorService listeningExecutor,
        ScheduledExecutorService scheduledExecutor /* purge scheduled executor */,
        ExecutorService executor /* File cache executor */,
        int purgeInterval /* async purge interval secs */,
        int stagingRetryInterval /* async retry interval secs */); @Nullable File getIfPresent(String key); @Nullable @Override File getIfPresent(Object key); File get(String key); @Override void invalidate(Object key); boolean stage(String key, File file); DataStoreCacheStatsMBean getStagingCacheStats(); DataStoreCacheStatsMBean getCacheStats(); @Override void close();  }
@Test public void getNoCache() throws IOException { LOG.info("Starting getNoCache"); expectedEx.expect(IOException.class); cache.get(ID_PREFIX + 0); LOG.info("Finished getNoCache"); }
@Test public void getIfPresentStaged() throws IOException { LOG.info("Starting getIfPresentStaged"); get(false); LOG.info("Finished getIfPresentStaged"); }
@Test public void getStaged() throws IOException { LOG.info("Starting getStaged"); get(true); LOG.info("Finished getStaged"); }