Skip to content

Conversation

@muningis
Copy link
Contributor

The author should do the following, if applicable

  • Add tests
  • Run tests
  • yarn changeset at the top of this repo and push the changeset
  • Follow the contribution guide

@changeset-bot
Copy link

changeset-bot bot commented Dec 24, 2025

🦋 Changeset detected

Latest commit: 641960f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/response-cache Minor

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

@muningis muningis mentioned this pull request Dec 24, 2025
4 tasks
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.30%. Comparing base (3773043) to head (641960f).

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              
Flag Coverage Δ
response-cache 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BarryThePenguin
Copy link
Contributor

Looks like you need to run yarn install

Also, make sure to include { "path": "packages/response-cache" } in tsconfig.json

"devDependencies": {
"arktype": "^2.0.0",
"hono": "^4.11.1",
"hono": "^4.10.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"hono": "^4.10.1",
"hono": "^4.11.1",

Copy link
Contributor Author

@muningis muningis Dec 24, 2025

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.

"valibot": "^1.0.0",
"vitest": "^4.0.16",
"zod": "^4.2.1"
"vitest": "^3.2.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"vitest": "^3.2.4"
"vitest": "^4.0.16"

@muningis muningis changed the title Response cache 2 feat(response cache): initial implementation Dec 24, 2025
### Add logging

```ts
import { cacheMiddleware } from '@hono/response-cache'
Copy link
Member

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) => {
Copy link
Member

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),
Copy link
Member

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) => {
Copy link
Member

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?

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.

3 participants