Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-fresh #4191

Closed
erwinmombay opened this issue Jul 25, 2016 · 20 comments
Closed

amp-fresh #4191

erwinmombay opened this issue Jul 25, 2016 · 20 comments
Assignees
Labels
INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code P2: Soon Type: Feature Request

Comments

@erwinmombay
Copy link
Member

The cache operates on a stale-while-revalidate model. This means that a document when viewed by a user on the client could be stale as revalidation only happens in the background and effects subsequent page views. While this is acceptable for most content, some sections of a page are critical or sensitive enough that it warrants always having the latest piece of information such as item pricing and rating. A good example of this scenario is in e-commerce and long tail product pages which might not be visited often but should have the correct price or quantity remaining when viewed.


Will post design doc shortly.

@erwinmombay erwinmombay added the INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code label Jul 25, 2016
@ericlindley-g ericlindley-g added this to the Current milestone Jul 28, 2016
@ericlindley-g
Copy link
Contributor

@erwinmombay — Calling this "Current", but please update if that's not quite right. Thanks!

@jpettitt
Copy link
Contributor

Is this essentially a one time amp-live-list?

@erwinmombay
Copy link
Member Author

erwinmombay commented Sep 22, 2016

@jpettitt the mechanism is, but as far as usage this component is really for an edge case for long tail pages wherein a 1 behind copy from the cache would be bad (like a 1 year old e-commerce page being the user's first landing experience and has super stale quantity count). Will add more documentation soon

@Gregable
Copy link
Member

Why not just use standard HTTP expiry headers for communicating this information to the AMP Cache, rather than an HTML tag?

@jpettitt
Copy link
Contributor

Hmm, I knew the cache only took max-age as a hint. However you're saying it doesn't support stale-while-revalidate ? Is there some max ttl or could things theoretically persist forever?

Which error conditions cause the cache to invalidate? If it gets a 404 or 410 I know it drops the doc. What about 5xx codes?

@jridgewell
Copy link
Contributor

Why not just use standard HTTP expiry headers for communicating this information to the AMP Cache, rather than an HTML tag?

Our stale-while-revalidate would cause bad data to be shown while we refetch.

@adelinamart
Copy link
Contributor

What's the latest status here? Thanks.

@ericlindley-g
Copy link
Contributor

Still very important—#7463 may address the primary use cases for this. Will definitely want to keep both top-of-mind.

@cramforce
Copy link
Member

#7463 isn't really a replacement for amp-fresh, but #7907 would address the majority of use cases.

@jpettitt
Copy link
Contributor

Any status update on this? We'd like to implement it for school closings / weather on pages where we can't use amp list.

@ericlindley-g
Copy link
Contributor

Thanks for checking in, @jpettitt — Current thinking includes the feature described by @choumx in this issue: #9862 Can you say if that feature would fit your needs?

@erwinmombay
Copy link
Member Author

i believe this has been replaced by amp-bind + amp-state mechanism right @ericlindley-g ? i believe features that amp-fresh would have provided have been covered by amp-bind + amp-state

@ericlindley-g
Copy link
Contributor

That's right, in part: there are a few ways that we're working to address recency in AMP. One is the amp-bind + amp-state mechanism, where amp-state can pull in fresh data at load time. Another is the amp-fresh-like behavior described in #9862

@erwinmombay
Copy link
Member Author

i'll remove the code for amp-fresh and its docs

@ericlindley-g
Copy link
Contributor

Closing this based on features mentioned above that fill the need, but please chime in if your use case for fresh data in AMP pages isn't covered yet (/cc @lswang1618 )

@alankent
Copy link

What about seasonal themes? During Christmas, I make significant changes to the CSS and look of the site to make it feel more seasonal. The CSS is in the AMP page, not fetched via amp-bind/amp-state etc. To stop Christmas themed pages coming up for tail products later, I think it would be useful for a site to control the stale-while-revalidate timeout. E.g. a site might set it to a value like a few days so seasonal themes cannot last too long in the cache (or set it based on how many days before Christmas so they all time out exactly on Christmas eve).

@ericlindley-g
Copy link
Contributor

That a good use case to cover — I think the solution would be to fix this directly in a given AMP Cache. My assumption is that the existing update-cache request for the Google AMP Cache would trigger a fetch on too many pages at once for some merchants to be practical (?)

@alf7 and @rudygalfi for thoughts

@cramforce
Copy link
Member

The update cache API is the way to go. Merchants can throttle requests so it doesn't overwhelm themselves.

@alankent
Copy link

First, yes, if a ecomm site had 1M SKUs, that would be 1M update-cache requests.

But more importantly, you are assuming the Google AMP Cache is the only cache. A merchant should not have to know what caches have been implemented. Making the merchant responsible to set a stale-while-revalidate (or max-stale or whatever) timeout header is fine, but asking them to keep an up to date list of caches seems "wrong".

@cramforce
Copy link
Member

cramforce commented Apr 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INTENT TO IMPLEMENT Proposes implementation of a significant new feature. https://bit.ly/amp-contribute-code P2: Soon Type: Feature Request
Projects
None yet
Development

No branches or pull requests

8 participants