private synchronized boolean canCacheNewValueOfSize(int newValueSize) {
    return (newValueSize <= mMemoryCacheParams.maxCacheEntrySize)
        && (getInUseCount() <= mMemoryCacheParams.maxCacheEntries - 1)
        && (getInUseSizeInBytes() <= mMemoryCacheParams.maxCacheSize - newValueSize);
  }
Checks the cache constraints to determine whether the new value of given size can be cached or
not.
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/LruCountingMemoryCache.java