0% cache hits
I just setup accelerate and have verified it's working, but I keep getting 0% cache hit rate. How do I debug this? I think I am making the exact same query repeatedly
3 Replies
Hi @Gabe 👋
Can you confirm that you have explicitly defined a cache strategy for your queries. By default, Accelerate does not cache queries unless you opt-in. Here is an example of how to define a cache strategy:
This example sets a stale-while-revalidate (SWR) and time-to-live (TTL) of 60 seconds each.
See the documentation
Getting started with Prisma Accelerate | Prisma Documentation
Learn how to get up and running with Prisma Accelerate.
Yes, I have via my middleware
Lemme make sure by adding it manually to some queries just in case
For some reason my middleware just isn't working. Adding the cache strategy to individual queries works
Fixed:
Thanks for the help! I probably should've noticed that cache configured queries was 0 🙂