feat(response cache): initial implementation#1652
feat(response cache): initial implementation#1652muningis wants to merge 10 commits intohonojs:mainfrom
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.
| "hono": "^4.10.1", | |
| "hono": "^4.11.1", |
There was a problem hiding this comment.
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.
| "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' |
| set: (key, value) => { | ||
| cacheStorage.set(key, value) | ||
| }, | ||
| delete: (key) => { |
| 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.
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.
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