@Test
  public void testHasKeyWithPopulateAtStartupWithAwaitingIndex() throws Exception {
    DiskStorageCache cache2 = createDiskCache(mStorage, false);
    // A new cache object in the same directory. Equivalent to a process restart.
    // Index should be updated.
    CacheKey key = putOneThingInCache(cache2);
    // Wait for index populated in cache before use of cache
    cache2.awaitIndex();
    assertTrue(cache2.isIndexReady());
    assertTrue(cache2.hasKeySync(key));
    assertTrue(cache2.hasKey(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