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.

uses-long-cache is too strict

See original GitHub issue

The audit uses-long-cache is too restrictive as it basically requires a cache set to a value larger than 96.5 days to pass.

See https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/audits/byte-efficiency/uses-long-cache-ttl.js#L35

If instead the threshold was decreased to >= 90%. Then an asset cached for a week would be ok.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
paulirishcommented, Nov 10, 2020
  1. lets see if we have any recent data on cache entry ages. it’s possible our 1yr guidance is wild and 1week is just find
  2. docs should def mention suggested cache time. (also should link to stale-while-revalidate)
  3. audit should give requests a pass if they use SWR
1reaction
patrickhulcecommented, Sep 3, 2020

Would you in that case consider having two thresholds, one for those assets with hash or version-id, and another lower threshold for the remaining assets.

That sounds reasonable though I’m not sure what we would ask of the remaining assets. Our thinking was "hey if this thing actually changes, you probably want to keep it up to a year but throw must-revalidate on there or something instead."The best retort I think we’ve heard so far to that was “we would ideally want must-revalidate but we’re OK with very slightly stale responses without a revalidation to save requests so we use 4 hours instead” The problem is there’s no real way for us to differentiate that case from the case of poorly chosen cache lifetimes. Hence, why I’m back to narrowing the scope of the audit instead.

Also, it’d be great if the page https://web.dev/uses-long-cache-ttl/ would be explicit about the suggested cache time.

Yeah docs should be updated either way no matter what we do here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make use of long-term caching - web.dev
Use bundle versioning and cache headers #. The common approach of doing caching is to: tell the browser to cache a file for...
Read more >
How to Fix the Leverage Browser Caching Warning in ... - Kinsta
1. Add Cache-Control and Expires Headers. There are two headers related to browser caching: Cache-Control and Expires. At least one must be ...
Read more >
Server-side caching - Apollo GraphQL Docs
When Apollo Server resolves an operation, it calculates the result's correct cache behavior based on the most restrictive settings among the result's fields ......
Read more >
Cache-Control - HTTP - MDN Web Docs
So those are hard to store in a cache with max-age . In such a case, you could address the caching needs by...
Read more >
Understanding Cache: How Caching Impacts Site Speed
Think of caching as the digital equivalent of keeping copies of the files you reference most frequently on your desk, so you don't...
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