You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
■ Overview
I'm trying to retrieve a list of regional information stored in DynamoDB using Amplify Gen2's data feature in TypeScript.
(I understand this isn't an Amplify community.)
This code retrieves the list of areas from the browser, but because the list is very large, it can't be retrieved in a single Query.
Therefore, I use loop processing with nextToken, repeating the process until there's no nextPageToken in the API response.
app/page.tsx
let areaList;
do {
areaList = await Area.list({ nextToken: nextPageToken });
} while(areaList.nextPageToken);
From here on, this is a general discussion:
For this listArea Query, I set $context.args as the cache key from the management console and set a TTL.
If 10 loops occur to retrieve this area list, I think PER_RESOLVER_CACHE will maintain about 10 caches using nextToken as the cache key.
■ Question
If a specific area record is updated, I need to flush all caches of listArea in the resolver.
Can I delete all listArea caches by using evictFromApiCache and specifying nextToken with a wildcard?
Or is there an easier way?
Since I can't solve this problem, I'm considering creating Lambda resolvers that retrieve all regional information at once and setting up caching for this resolver.
The text was updated successfully, but these errors were encountered:
■ Overview
I'm trying to retrieve a list of regional information stored in DynamoDB using Amplify Gen2's data feature in TypeScript.
(I understand this isn't an Amplify community.)
This code retrieves the list of areas from the browser, but because the list is very large, it can't be retrieved in a single Query.
Therefore, I use loop processing with nextToken, repeating the process until there's no nextPageToken in the API response.
From here on, this is a general discussion:
For this listArea Query, I set $context.args as the cache key from the management console and set a TTL.
If 10 loops occur to retrieve this area list, I think PER_RESOLVER_CACHE will maintain about 10 caches using nextToken as the cache key.
■ Question
If a specific area record is updated, I need to flush all caches of listArea in the resolver.
Can I delete all listArea caches by using evictFromApiCache and specifying nextToken with a wildcard?
Or is there an easier way?
Since I can't solve this problem, I'm considering creating Lambda resolvers that retrieve all regional information at once and setting up caching for this resolver.
The text was updated successfully, but these errors were encountered: