docs: public @Nullable CloseableReference<V> cache(
        final K key, final CloseableReference<V> valueRef, final EntryStateObserver<K> observer) {
      Preconditions.checkNotNull(key);
      Preconditions.checkNotNull(valueRef);
  
      maybeUpdateCacheParams();
  
      Entry<K, V> oldExclusive;
      CloseableReference<V> oldRefToClose = null;
      CloseableReference<V> clientRef = null;
      synchronized (this) {
        // remove the old item (if any) as it is stale now
        oldExclusive = mExclusiveEntries.remove(key);
        Entry<K, V> oldEntry = mCachedEntries.remove(key);
        if (oldEntry != null) {
          makeOrphan(oldEntry);
          oldRefToClose = referenceToClose(oldEntry);
        }
  
        if (canCacheNewValue(valueRef.get())) {
          Entry<K, V> newEntry = Entry.of(key, valueRef, observer);
          mCachedEntries.put(key, newEntry);
          clientRef = newClientReference(newEntry);
        }
      }
      CloseableReference.closeSafely(oldRefToClose);
      maybeNotifyExclusiveEntryRemoval(oldExclusive);
  
      maybeEvictEntries();
      return clientRef;
    }