- 
                Notifications
    You must be signed in to change notification settings 
- Fork 178
Closed
Description
I had a conversation with the Vercel devs and they said that their cacheHandle makes use of lru-cache to prevent extraneous calls to S3 (or any external datastore). When I was using sst NextjsSite, I noticed lots of S3 hits too:
async get(key, isFetch) {
    const result = await s3Client.send(
      new GetObjectCommand({
        Bucket: CACHE_BUCKET_NAME,
        Key: buildS3Key(key, isFetch ? "fetch" : "cache"),
      }),
    );
    const cacheData = JSON.parse(
      (await result.Body?.transformToString()) ?? "{}",
    );
    return {
      value: cacheData,
      lastModified: result.LastModified?.getTime(),
    };
  },
Whenever a page is reloaded, it would make the S3 call due to the get. Is this correct behavior? Or should we place lru-cache here before hitting S3? eg if cache is null or is stale.
CC: @conico974 @vicb
Metadata
Metadata
Assignees
Labels
No labels