if you use aws4fetch, you can get free caching without needing to fiddle with the Cache API manually

if you use aws4fetch, you can get free caching without needing to fiddle with the Cache API manually.

const aws_client = new AwsClient({
  accessKeyId: c.env.S3_ACCESS_KEY_ID,
  secretAccessKey: c.env.S3_SECRET_ACCESS_KEY,
  retries: 0,
  service: "s3",
})

const s3_url = new URL(`${c.env.S3_ENDPOINT}/${sha256}.json`);

const s3_result = await aws_client.fetch(s3_url.toString(), {
  method: "GET",
  cf: {
    cacheEverything: true,
    cacheTtl: 31536000, // 1 year
  }
});
Was this page helpful?