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

ben-manes / caffeine / #3104
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: v3.dev
DEFAULT BRANCH: master
Ran 29 May 2022 05:13PM UTC
Jobs 1
Files 77
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

pending completion
#3104

push

github-actions

ben-manes
Less aggressively discard refreshes due to possible conflicts

Linearization means that the refresh should be dropped if another write
for that entry occurs, as we may populate the cache with stale data. The
cache used a write timestamp to help detect this. However, when this
could be too aggressive when a refresh runs concurrently with the async
load completing.

An inflight load is given an infinite timestamp so that it never expires.
A whenComplete callback then updates the entry with its policy metadata,
such as its expiration time. That changes the write timestamp and if a
refresh runs concurrently with the callback then the refresh may see the
infinite timestamp, the replace updates it, and the refresh drops the
entry as a conflict.

Instead, if the refresh is successfully unregistered within the entry's
compute to swap the value, then it can be assumed to be valid. Any other
write will discard the refresh under the entry's compute, so we retain
linearizability. This requires that the load callback to update the
metadata does not discard the refresh, since that is not needed for a
psuedo write.

The write timestamp trick for ABA detection is a layover from the
previous implementation (2.x) which did not promise linearization.

Note that a refresh is optimistic and races with other writes, so it
may be discarded. As it relies on callbacks to write back into the
cache, one cannot expect the entry to be updated after the reload
completes (e.g. see #714).

21 of 21 new or added lines in 5 files covered. (100.0%)

7068 of 7196 relevant lines covered (98.22%)

0.98 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #3104.1 29 May 2022 05:13PM UTC 0
98.22
Source Files on build #3104
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #3104
  • e61a2481 on github
  • Prev Build on v3.dev
  • Next Build on v3.dev
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