mkodekar / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Inconsistency between CacheStats documentation and behaviour #1850

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The class JavaDoc for CacheStats states: "No stats are modified on a query to 
{@link Cache#getIfPresent}."

However, the LocalCache.getIfPresent() method clearly updates stats:

  @Nullable
  public V getIfPresent(Object key) {
    int hash = hash(checkNotNull(key));
    V value = segmentFor(hash).get(key, hash);
    if (value == null) {
      globalStatsCounter.recordMisses(1);
    } else {
      globalStatsCounter.recordHits(1);
    }
    return value;
  }

Original issue reported on code.google.com by wes...@cutterslade.ca on 19 Sep 2014 at 5:00

GoogleCodeExporter commented 9 years ago
This was actually reported internally just a short while ago; the fix has been 
submitted but not mirrored out.

Original comment by lowas...@google.com on 19 Sep 2014 at 5:36

GoogleCodeExporter commented 9 years ago
Was the fix an update to the JavaDoc or to remove the stats modification from 
getIfPresent()?

Original comment by wes...@cutterslade.ca on 19 Sep 2014 at 5:47

GoogleCodeExporter commented 9 years ago
We changed the docs.

Original comment by lowas...@google.com on 19 Sep 2014 at 6:12

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:07