@Test
  public void testHasKeyWithoutPopulateAtStartupWithoutAwaitingIndex() throws Exception {
    CacheKey key = putOneThingInCache();
    // A new cache object in the same directory. Equivalent to a process restart.
    // Index may not yet updated.
    DiskStorageCache cache2 = createDiskCache(mStorage, false);
    assertTrue(cache2.isIndexReady());
    assertFalse(cache2.hasKeySync(key));
    assertTrue(cache2.hasKey(key));
    // hasKey() adds item to the index
    assertTrue(cache2.hasKeySync(key));
  }
Verify that multiple threads can write to the cache at the same time.
imagepipeline-base/src/test/java/com/facebook/cache/disk/DiskStorageCacheTest.java