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: allow to check if a response is cacheable #18

Merged
merged 2 commits into from
Apr 1, 2021

Conversation

dunglas
Copy link
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?

cacheobject/object.go Outdated Show resolved Hide resolved
@@ -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
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
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.

cacheobject/object.go Show resolved Hide resolved
Co-authored-by: Darkweak <sylvain@les-tilleuls.coop>
@soyuka
Copy link

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