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: add Prisma Accelerate caching to some of our queries #22

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

stefl
Copy link
Contributor

@stefl stefl commented Aug 28, 2024

Description

  • Adds Prisma Accelerate caching to some of our queries.
  • These are queries on tables which are write-once or only update during the chat.
  • We could see how this performs in the Prisma Accelerate dashboard and then potentially consider some other tables which might benefit from caching.

How to test

  • Use the app to ensure that we aren't seeing any strange behaviour
  • Check the Prisma Accelerate dashboard - we should see a higher percentage of cached queries if this is successful

@Stef screenshotted this on 2024-08-29 at 14 24 56@2x

Copy link

vercel bot commented Aug 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
oak-ai-lesson-assistant ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 9:48am

@stefl stefl changed the title feat: add Prisma Accelerate caching to some of our tables WIP feat: add Prisma Accelerate caching to some of our tables Aug 28, 2024
@@ -115,6 +115,7 @@ async function getHandler(req: Request): Promise<Response> {
gdriveFileId: fileId,
userId,
},
cacheStrategy: { ttl: 60 * 5, swr: 60 * 2 },
Copy link
Contributor Author

@stefl stefl Aug 28, 2024

Choose a reason for hiding this comment

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

The pattern is to add a TTL and SWR setting to each request that looks cacheable

@stefl stefl changed the title WIP feat: add Prisma Accelerate caching to some of our tables feat: add Prisma Accelerate caching to some of our tables Aug 28, 2024
Copy link

github-actions bot commented Aug 28, 2024

Playwright e2e tests

Job summary

Download report

To view traces locally, unzip the report and run:

npx playwright show-report ~/Downloads/playwright-report

@stefl stefl changed the title feat: add Prisma Accelerate caching to some of our tables feat: add Prisma Accelerate caching to some of our queries Aug 29, 2024
@stefl stefl requested a review from a team August 29, 2024 08:19
Copy link
Collaborator

@mantagen mantagen left a comment

Choose a reason for hiding this comment

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

LGTM! Could also add caching to the lessonSchema requests I think.

Keen to get a better idea of when the data could be stale, and what the impact of that would be

Copy link

@stefl stefl merged commit 7a797ac into main Aug 29, 2024
13 checks passed
@stefl stefl deleted the feat/accelerate_caching_some_tables branch August 29, 2024 13:25
@oak-machine-user
Copy link
Collaborator

🎉 This PR is included in version 1.3.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants