-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
backendFeature/issues related to backend workflowFeature/issues related to backend workflowenhancementNew feature or requestNew feature or requesthacktoberfestperformanceimproves performanceimproves performance
Description
Is your feature request related to a problem?
Our extension currently caches translations on the client-side, which is great for individual users. However, if 1,000 different users translate the same popular code snippet, our backend still makes 1,000 separate calls to the Gemini API, which is inefficient and costly.
Describe the solution you'd like
Implement server-side caching using Cloudflare KV (a key-value store). The workflow should be:
- When a translation request comes in, create a unique key from the code snippet and target language.
- Before calling the Gemini API, check if this key exists in the KV store.
- If it exists, return the cached translation immediately.
- If it doesn't exist, call the Gemini API, return the translation to the user, and also save the result to the KV store with a TTL (Time To Live) of a few days.
Additional context
This is a high-impact feature that will significantly improve response times for common requests and dramatically lower our Gemini API usage costs. It requires knowledge of Cloudflare Workers and the KV store API.
Metadata
Metadata
Assignees
Labels
backendFeature/issues related to backend workflowFeature/issues related to backend workflowenhancementNew feature or requestNew feature or requesthacktoberfestperformanceimproves performanceimproves performance