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.

Getting cache hit even when changing appendedCacheKey

See original GitHub issue

If I change appendedCacheKey between runs I still get a cache hit.

Here I changed the append key to debug-20710ef73d32fa66a66a4fb0ed803cdce8b4099f55c53e82b7de0ec2a6fbf743-v2 for this run. It picks up the Cache key properly Cache key: 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc2124e8de991a4e45a8edcb3b4c69_appendedKey=debug-20710ef73d32fa66a66a4fb0ed803cdce8b4099f55c53e82b7de0ec2a6fbf743-v2' but then it says Cache restore keys: 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc2124e8de991a4e45a8edcb3b4c69' and then Cache hit, key = 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc21[24](https://github.com/EpicGames/zen/runs/5598118276?check_suite_focus=true#step:4:24)e8de991a4e45a8edcb3b4c69_appendedKey=release-20710ef73d32fa66a66a4fb0ed803cdce8b4099f55c53e82b7de0ec2a6fbf743'. which is wrong?

Or does it deem them to be the same?

I’m running this in a private repo so sadly I can’t give you access to the full build log.

Restore vcpkg and its artifacts from cache
  Cache key: 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc2124e8de991a4e45a8edcb3b4c69_appendedKey=debug-20710ef73d32fa66a66a4fb0ed803cdce8b4099f55c53e82b7de0ec2a6fbf743-v2'
  Cache restore keys: 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc2124e8de991a4e45a8edcb3b4c69'
  Cached paths: 'D:/a/zen/b/vcpkg_cache,D:\a\zen\zen\vcpkg,!D:\a\zen\zen\vcpkg\installed,!D:\a\zen\zen\vcpkg\vcpkg_installed,!D:\a\zen\zen\vcpkg\packages,!D:\a\zen\zen\vcpkg\buildtrees,!D:\a\zen\zen\vcpkg\downloads'
  Cache Size: ~1001 MB (1049780280 B)
  C:\Windows\System32\tar.exe -z -xf D:/a/_temp/e7d[23](https://github.com/EpicGames/zen/runs/5598118276?check_suite_focus=true#step:4:23)e4a-1f59-4550-a2e9-d05d01f2df12/cache.tgz -P -C D:/a/zen/zen
  Cache hit, key = 'runnerOS=win2220220306.1-vcpkgGitCommit=5962cf5a3bfc21[24](https://github.com/EpicGames/zen/runs/5598118276?check_suite_focus=true#step:4:24)e8de991a4e45a8edcb3b4c69_appendedKey=release-20710ef73d32fa66a66a4fb0ed803cdce8b4099f55c53e82b7de0ec2a6fbf743'.

The reason why I’m exploring this is because my MacOS x86_64 target does not seem to use the cache properly but instead rebuilds all dependent packages taking 1-2 hours to run.

All other platforms (Linux x86_64, Windows x86_64, MacOSX arm64) uses the cache properly - even though they show the same cache hit behaviour and do not recompile the dependencies even if I change appendedCacheKey.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
lukkacommented, Oct 5, 2022

The latest version of run-vcpkg@v10 adds the prependedCacheKey input, which helps in invalidating previously created caches. It also documents how to properly handle the saving of the cache when a failure and cancellation occurs.

@DanEngelbrecht @DrMcCoy @akrieger could this issue be closed or there is something else to do on run-vcpkg side? Let me know, thanks!

1reaction
lukkacommented, Sep 26, 2022

@akrieger IIRC there is a test on the commit id to represent a SHA1 string which would prevent your idea to work, which would be neat BTW.

I think prepending the user provided key is sensible indeed, as requested as well in #160 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

When They Occur (& How to Increase Cache Hit Ratio)
Learn why it is important to have a caching policy, when cache miss and cache hit occur, how cache hit ratio is calculated...
Read more >
Specifying how long CloudFront caches your objects
The following sections explain how to improve your cache hit ratio. Topics. Specifying how long CloudFront caches your objects; Using Origin Shield; Caching...
Read more >
What is a cache hit and a cache miss? Why would context ...
If a cache miss has occurred, that means the processor has go to main memory to fetch the address and it takes some...
Read more >
Cache Miss vs Cache Hit: What's the Difference? - WP Rocket
A cache hit is when content is successfully served from the cache instead of the server.
Read more >
The truth about cache hit ratios | Fastly
Cache hit ratio is a common metric that evaluates a CDN's performance. ... likely to get evicted from a cache even if their...
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