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.

Respect cache_until when retrieving embeds

See original GitHub issue

The oEmbed spec defines cache_age as

The suggested cache lifetime for this resource, in seconds. Consumers may choose to use this value or not.

My initial search hasn’t pulled up any details about this being used. It would be helpful if this was stored on the embed model. This could be used in conjunction with last_modified for automatically refreshing stale content.

Since last_modified doesn’t necessarily translate to when the data was fetched, there could ideally be an additional field that captures the fetch time.

This could also be combined into one DateTime field cache_until which would simplify queries and simply be set to the fetch time plus the cache age.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gasmancommented, Jun 18, 2021

Thanks @thenewguy! I’d be inclined to treat stale embeds in the same way as an embed that has never been fetched at all - if the re-fetch fails then I think it’s reasonable enough to propagate that failure back to the end-user. From a quick look I think that can be done as a two-line change to get_embed - exclude embeds with a cache_until in the past when fetching, and change the get_or_create to an update_or_create so that the stale embed is overwritten on successful fetch.

In the meantime, I’ll go ahead and merge your PR as that all looks good to me.

0reactions
gasmancommented, Jun 25, 2021

Fixed in #7279

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent unnecessary network requests with the HTTP Cache
no-cache . This instructs the browser that it must revalidate with the server every time before using a cached version of the URL....
Read more >
An in-depth introduction to HTTP caching: Cache-Control & Vary
Conditional requests allow caches to retrieve resources only if they are different from the one they have in their local storage.
Read more >
Caching overview | Cloud CDN - Google Cloud
Cloud CDN offers three cache modes, which define how responses are cached, whether Cloud CDN respects cache directives sent by the origin, and...
Read more >
HTTP Expires header not respected by browser?
The browser ignores the Expires header if you refresh the page. It always checks whether the cache entry is still valid by contacting...
Read more >
6 Caching and Compressing Content - Oracle Help Center
When you establish a caching rule, objects matching the rule are not cached until there is a client request for them. When a...
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