@Override
  public @Nullable BinaryResource getResource(final CacheKey key) {
    String resourceId = null;
    SettableCacheEvent cacheEvent = SettableCacheEvent.obtain().setCacheKey(key);
    try {
      synchronized (mLock) {
        BinaryResource resource = null;
        List<String> resourceIds = CacheKeyUtil.getResourceIds(key);
        for (int i = 0; i < resourceIds.size(); i++) {
          resourceId = resourceIds.get(i);
          cacheEvent.setResourceId(resourceId);
          resource = mStorage.getResource(resourceId, key);
          if (resource != null) {
            break;
          }
        }
        if (resource == null) {
          if (mCacheEventListener != null) {
            mCacheEventListener.onMiss(cacheEvent);
          }
          mResourceIndex.remove(resourceId);
        } else {
          Preconditions.checkNotNull(resourceId);
          if (mCacheEventListener != null) {
            mCacheEventListener.onHit(cacheEvent);
          }
          mResourceIndex.add(resourceId);
        }
        return resource;
      }
    } catch (IOException ioe) {
      mCacheErrorLogger.logError(
          CacheErrorLogger.CacheErrorCategory.GENERIC_IO, TAG, "getResource", ioe);
      cacheEvent.setException(ioe);
      if (mCacheEventListener != null) {
        mCacheEventListener.onReadException(cacheEvent);
      }
      return null;
    } finally {
      cacheEvent.recycle();
    }
  }
Retrieves the file corresponding to the mKey, if it is in the cache. Also touches the item,
thus changing its LRU timestamp. If the file is not present in the file cache, returns null.

<p>This should NOT be called on the UI thread.

@param key the mKey to check
@return The resource if present in cache, otherwise null
imagepipeline-base/src/main/java/com/facebook/cache/disk/DiskStorageCache.java