Skip to content

feat: allow to check if a response is cacheable#18

Merged
pquerna merged 2 commits intopquerna:masterfrom
dunglas:feat/no-response
Apr 1, 2021
Merged

feat: allow to check if a response is cacheable#18
pquerna merged 2 commits intopquerna:masterfrom
dunglas:feat/no-response

Conversation

@dunglas
Copy link
Copy Markdown
Contributor

@dunglas dunglas commented Sep 22, 2020

I'm working on a cache module for Caddy server, and I need to check if the request will not be cacheable to prevent initializing some useless stuff. What do you think about allowing to do this with the library?

@@ -109,10 +93,29 @@ func CachableObject(obj *Object, rv *ObjectResults) {
if obj.ReqDirectives != nil && obj.ReqDirectives.NoStore {
rv.OutReasons = append(rv.OutReasons, ReasonRequestNoStore)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

shouldn't this also move to CachableResponseObject?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I hesitated but I don't think so, it's related to the request, not to the response.

Co-authored-by: Darkweak <sylvain@les-tilleuls.coop>
@soyuka
Copy link
Copy Markdown

soyuka commented Apr 1, 2021

status on this?

@pquerna pquerna merged commit f8f6533 into pquerna:master Apr 1, 2021
@dunglas dunglas deleted the feat/no-response branch November 22, 2021 17:48
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.

4 participants