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

(feat): Setup cache for GET artifact route #76

Merged
merged 1 commit into from
Sep 2, 2023
Merged

Conversation

AdiRishi
Copy link
Owner

@AdiRishi AdiRishi commented Sep 1, 2023

Confirmed that the cache works with a custom domain -
Screenshot 2023-09-01 at 6 17 23 pm

Summary by CodeRabbit

  • New Feature: Added caching functionality to the v8 Artifacts API. This feature will improve response times and reduce server load by storing frequently accessed data in cache.
  • Test: Added a new test case to ensure that the correct cache headers are being sent in the response from the server. This helps maintain the reliability of our caching system.

@coderabbitai
Copy link

coderabbitai bot commented Sep 1, 2023

Walkthrough

This update introduces caching to the v8 Artifacts API suite, enhancing performance by reducing server load. It also includes a new test case to ensure the correct cache headers are returned in server responses.

Changes

File Summary
src/routes/v8/artifacts.test.ts Added a new test case to verify the presence and correctness of Cache-Control headers in server responses.
src/routes/v8/artifacts.ts Implemented caching for GET requests using the cache module from 'hono/cache'. Configured cache name, duration, and revalidation settings.

🐇💻

"In the land of code where the shadows lie,

We added cache, as time does fly.

Now faster responses, oh so spry,

Underneath the digital sky." 🌌🚀


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance. The bot stays silent unless called upon.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between df9ae8b and e04cc4a commits.
Files selected for processing (2)
  • src/routes/v8/artifacts.test.ts (1 hunks)
  • src/routes/v8/artifacts.ts (2 hunks)
Additional comments (Suppressed): 2
src/routes/v8/artifacts.ts (2)
  • 1-6: The cache module from 'hono/cache' is imported but not used in the old hunk. Ensure that it's being used appropriately in other parts of the code.

  • 43-53: The caching configuration seems appropriate for the GET artifact route. However, ensure that the cache name 'r2-artifacts' does not conflict with any existing cache names in the application. Also, verify that the max-age and stale-while-revalidate values align with your application's caching strategy.

src/routes/v8/artifacts.test.ts Show resolved Hide resolved
@AdiRishi AdiRishi merged commit 84ce90e into master Sep 2, 2023
4 checks passed
@AdiRishi AdiRishi deleted the arishi-cache branch September 2, 2023 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant