Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Provide API to see if a cache records statistics
Revert commit
  • Loading branch information
PrimroseZhang committed Oct 20, 2024
1 parent fe04230 commit d075ad6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
16 changes: 0 additions & 16 deletions guava/src/com/google/common/cache/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,4 @@ public interface Cache<K, V> {
* performed -- if any -- is implementation-dependent.
*/
void cleanUp();

/**
* Returns whether this cache is recording statistics.
*
* <p>If this method returns {@code false}, the {@link #stats()} method will return
* a {@link CacheStats} instance with zero for all values.
*
* <p>The default implementation returns {@code false}. Implementations that support
* statistics recording should override this method to return {@code true} when appropriate.
*
* @return {@code true} if this cache is recording statistics, {@code false} otherwise
* @since 33
*/
default boolean isRecordingStats() {
return false;
}
}
9 changes: 0 additions & 9 deletions guava/src/com/google/common/cache/LocalCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -4956,15 +4956,6 @@ public CacheStats stats() {
return aggregator.snapshot();
}

/**
* Returns whether this cache is recording statistics.
*
* @return {@code true} if this cache is recording statistics, {@code false} otherwise
*/
public boolean isRecordingStats() {
return !localCache.globalStatsCounter.equals(CacheBuilder.EMPTY_STATS);
}

@Override
public void cleanUp() {
localCache.cleanUp();
Expand Down

0 comments on commit d075ad6

Please sign in to comment.