Respect cache_until when retrieving embeds
See original GitHub issueThe 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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 acache_until
in the past when fetching, and change theget_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.
Fixed in #7279