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

feat(cache): cache event handler stream response #2933

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

kerwanp
Copy link

@kerwanp kerwanp commented Dec 12, 2024

🔗 Linked issue

❓ Type of change

  • ✨ New feature (a non-breaking change that adds functionality)

📚 Description

Problem

When a stream is used in a cachedEventHandler the cached body is the serialized stream and not the result of this stream.
Resulting in an undesired behavior as the response sent when taken from the cache is the serialized stream.

Solution

This pull request add the ability to use defineCachedEventHandler with stream responses.
When the eventHandler returns a stream, the response of this stream is cached rather than the stream itself.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@kerwanp kerwanp requested a review from pi0 as a code owner December 12, 2024 15:30
@kerwanp
Copy link
Author

kerwanp commented Jan 26, 2025

As I am not aware of all the implications this implementation would have on all the different runtimes, I would be happy to discuss further on how this feature can get merged! @pi0

@pi0 pi0 added the cache label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants