• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ben-manes / caffeine / #2875 / 1
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: v3.dev
DEFAULT BRANCH: master
Ran 10 Apr 2022 07:43AM UTC
Files 75
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Apr 2022 05:35AM UTC coverage: 94.78% (-0.2%) from 94.936%
#2875.1

push

github-actions

ben-manes
Add Interner type for weakKey equality caching (fixes #344)

A weak keyed cache uses identity equivalence, as this is the only sensible
approach when caching a value. If Objects.equals was used then the user
would not be inclined to hold a reference to the canonical key and expect
any equivalent key to cause the mapping to be retained. As that is an
impossible expectation, the cache would seemingly discard prematurely.
Therefore we disallow this case to hint that users should be more thoughtful
about their desired behavior.

An interner is a Set-based cache where the key is the only item of interest.
This allows usages to resolve to a canonical instance, discard duplicates
as determined by Object.equals, and thereby reduce memory usage. A weak
interner allows the garbage collector to discard the canonical instance
when all usages have been reclaimed. This special case of a weak keyed
cache with Object.equals behavior is now supported, but hidden through
an interface to make the behavior explicit and avoid misuses.

For cases that want to cache by a canonical weak key to a value, the
two type should be used in conjunction. Instead of incorrectly trying
to combine into a single cache, use intern the key and use that for
the cache lookup.

6736 of 7107 relevant lines covered (94.78%)

0.95 hits per line

Source Files on job #2875.1
  • Tree
  • List 0
  • Changed 5
  • Source Changed 5
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2875
  • c41bcd4b on github
  • Prev Job for on v3.dev (##2871.1)
  • Next Job for on v3.dev (##2876.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc