-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add GreedyCacheStrategy #38
Conversation
Thank you for your interest. It's nice to see that this is useful to someone! I think that is a good thing to have this strategy. Sometimes we don't have the choice about following RFC 😉 . |
{ | ||
$response = $response->withAddedHeader( | ||
'Warning', | ||
'This response is cached although the response headers indicate not to do it!' |
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.
Maybe here we can follow the RFC 7234 fromating? Like:
299 - "This response is cached although the response headers indicate not to do it!"
https://tools.ietf.org/html/rfc7234#section-5.5
What do you think @jeromegamez ?
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.
Darnit, I just saw "Warning header" and thought that this was all - didn't recognize that the following section is a detailed specification :D.
I will change it as soon as I can, thanks for the heads up!
For me it's all good! Thanks 👍 |
Thanks for merging! |
You're welcome! Thanks for sharing your code! |
First of all: thank you for this middleware - it's well designed, and it was a pleasure integrating it (and saved me a lot of time) ❤️.
A propos ":heart:": it breaks mine to propose an addition that is not RFC-compliant, but I think it could still be useful for certain edge cases.
In my case, I had to access
This is where the Greedy Cache Strategy came to life - it stores responses in the cache for a fixed amount of time, and I use it in a second middleware inside the HandlerStack:
At least it adds a "Warning" header (see #24) 😄
Cheers!
Jérôme