问题
The Gmail and Calendar APIs return a nextPageToken
value in the response from the users.messages.list
and events.list
endpoints when pagination is required. If the value of the nextPageToken
is provided in the next request to these endpoints, the next page of results is returned.
My question: How long are these nextPageToken
s persisted behind the Gmail and Calendar APIs?
Context: I am building an abstraction on top of both the Gmail and Calendar APIs to return a list of Activities, and this endpoint has its own pagination. My pagination works by storing the nextPageToken
values returned by the Gmail and Calendar APIs in a cache and returning a UUID the client can specify in the next request to pop and use those Gmail and Calendar nextPageToken
s (just like the Google APIs themselves).
Goal: Configure my pagination cache TTL to, at most, be equal to the TTL (if there is one) of the Google APIs so that it always works as intended.
回答1:
nextPageToken
does not expire. It is just like an Index position. However if new items are added/deleted, you might not see the same result as you expect.
回答2:
The token expires after 1 Hour. I came to know about that while working with Google Directory API. Link to the problem I faced.
来源:https://stackoverflow.com/questions/39476276/how-long-are-nextpagetokens-remembered-for-gmail-and-calendar-apis