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

Minimize KV Operation #2

Merged
merged 3 commits into from
Dec 27, 2024
Merged

Minimize KV Operation #2

merged 3 commits into from
Dec 27, 2024

Conversation

arcestia
Copy link
Member

Making it more suitable for host in Cloudflare Free Plan.

arcestia and others added 3 commits December 27, 2024 14:09
Fixes #1

Minimize KV read, write, and delete operation consumption to make it more suitable for the free plan.

* **In-memory cache**: Add `statsCache` and `rateLimitCache` to store stats and rate limit data in memory.
* **Initialize stats**: Cache stats in memory to avoid repeated KV reads in the `initializeStats` function.
* **Stats middleware**: Batch updates to the stats and write them to the KV store periodically instead of on every request.
* **Rate limiting middleware**: Cache rate limit data in memory to avoid repeated KV reads and writes in the `checkRateLimit` function. Use a single KV read and write operation per request.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/arcestia/domainchecker/issues/1?shareId=XXXX-XXXX-XXXX-XXXX).
- Add canonical URL for stats page
- Integrate Tailwind CSS for styling
- Add JSON-LD structured data for better search indexing
Minimize consume of KV read, write & delete operation
@arcestia arcestia requested a review from Skiddle-Git December 27, 2024 07:47
@Skiddle-Git Skiddle-Git merged commit 076c5b7 into Skiddle-ID:main Dec 27, 2024
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.

2 participants