-
Notifications
You must be signed in to change notification settings - Fork 277
feat(response cache): initial implementation #1652
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 641960f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1652 +/- ##
==========================================
+ Coverage 92.24% 92.30% +0.06%
==========================================
Files 111 112 +1
Lines 3660 3692 +32
Branches 977 984 +7
==========================================
+ Hits 3376 3408 +32
Misses 250 250
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Looks like you need to run Also, make sure to include |
packages/response-cache/package.json
Outdated
| "devDependencies": { | ||
| "arktype": "^2.0.0", | ||
| "hono": "^4.11.1", | ||
| "hono": "^4.10.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "hono": "^4.10.1", | |
| "hono": "^4.11.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will rebase from master branch for these, as it also seems to be reason for why yarn install fails in CI.
packages/response-cache/package.json
Outdated
| "valibot": "^1.0.0", | ||
| "vitest": "^4.0.16", | ||
| "zod": "^4.2.1" | ||
| "vitest": "^3.2.4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "vitest": "^3.2.4" | |
| "vitest": "^4.0.16" |
…der filtering - Store full response (body, status, headers) instead of just body text - Filter sensitive headers (Set-Cookie, WWW-Authenticate, etc.) - Remove `respond` as it's inferred from `Content-Type` header - Add vitest tests
56f6d64 to
e109afb
Compare
| ### Add logging | ||
|
|
||
| ```ts | ||
| import { cacheMiddleware } from '@hono/response-cache' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be responseCache.
| set: (key, value) => { | ||
| cacheStorage.set(key, value) | ||
| }, | ||
| delete: (key) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be invalidate.
| enabled: true, | ||
| onHit: (key, c) => console.log(`Cache hit for ${key}`), | ||
| onMiss: (key, c) => console.log(`Cache miss for ${key}`), | ||
| onError: (key, c) => console.log(`Cache error for ${key}, error:`, error), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be onError: (key, c, error).
| set: vi.fn((key: string, value: string) => { | ||
| storage.set(key, value) | ||
| }), | ||
| invalidate: vi.fn((key: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalidate is not used in any place. Is it really necessary?
The author should do the following, if applicable
yarn changesetat the top of this repo and push the changeset