private synchronized void maybeUpdateCacheFraction(K key) {
    if (mLeastFrequentlyUsedKeysGhostList.contains(key)) {
      if (mLFUFractionPromil + mAdaptiveRatePromil <= MAX_FRACTION_PROMIL) {
        // key was recently evicted from LFU, if we had had larger LFU, we would have hit the
        // cache
        mLFUFractionPromil += mAdaptiveRatePromil;
      }
      // update the key's accessCount and move it to the youngest position since it should have been
      // accessed by now.
      mLeastFrequentlyUsedKeysGhostList.increaseValueIfExists(key);
    } else if (mLFUFractionPromil - mAdaptiveRatePromil >= MIN_FRACTION_PROMIL
        && mMostFrequentlyUsedKeysGhostList.contains(key)) {
      // key was recently evicted from MFU, if we had had larger MFU, we would have hit the
      // cache
      mLFUFractionPromil -= mAdaptiveRatePromil;
    }
  }
Changes the relative size of LFU and MFU if necessary and updates the ghost lists.
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/AbstractAdaptiveCountingMemoryCache.java