question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An output for exact cache hit

See original GitHub issue

I think it would be useful to indicate somehow whether cache was restored using the exact key or one of the fallback restore-keys.

A use case for this is being able to skip some subsequent steps only in the case of an exact cache hit. For example, if a build tool uses incremental compilation, a partial cache hit is good, it saves some time, but if the cache hit was exact, we can skip the compilation step altogether which might save us much more time (e.g. build tool loading the project). A concrete case of such build tool it sbt: in a medium-sized project with several modules it might spend up to a minute loading the project.

So I’m suggesting to add another output value to the action which will indicate whether hit was exact or not.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
jsorefcommented, Jan 23, 2022

cache-hit indeed is only true if you’re hitting the primary key.

Unfortunately, you can’t distinguish between a cache-miss and a hit of a restore-key.

I would love for cache-hit to tell me the key it hit instead of just a boolean for the primary key.

1reaction
OndrejSpanelcommented, Jan 18, 2022

After reading the documentation again I think cache-hit is set to true only on the exact hit, not on the restore key hit. You are therefore not notified about a partial hit at all - it might speed up something or it might not, you are expected to proceed as if there is no hit.

A boolean value to indicate an exact match was found for the key

This is confirmed by looking at sources:

            const isExactKeyMatch = utils.isExactKeyMatch(primaryKey, cacheKey);
            utils.setCacheHitOutput(isExactKeyMatch);

The documentation could perhaps be changed to explicitly state this, like:

A boolean value to indicate an exact match was found for the key (not set when only a restore key matches)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cache dependencies and build outputs in GitHub Actions
Outputs. cache-hit - A boolean value to indicate an exact match was found for the key. Note: cache ...
Read more >
Cache Hit Rate - an overview | ScienceDirect Topics
First, the cache hit rate of caching full IP addresses in the backbones is typically at most 80–90% [Par96, NMH97]. Part of the...
Read more >
CallCaching - Cromwell - Read the Docs
Call Caching allows Cromwell to detect when a job has been run in the past so that it doesn't have to re-compute results,...
Read more >
Performance tuning with result set caching - Microsoft Learn
Result set caching improves query performance and reduces compute resource usage. In addition, queries using cached results set do not use any ...
Read more >
What does it mean when action is reported as "local, remote ...
For instance, when the action is executed (clean build with no cache) and when the build is fully cached and output is populated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found