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

[Feature] Detecting cache hit #288

Closed
yohannj opened this issue Jan 24, 2023 · 0 comments · Fixed by #313
Closed

[Feature] Detecting cache hit #288

yohannj opened this issue Jan 24, 2023 · 0 comments · Fixed by #313
Assignees

Comments

@yohannj
Copy link

yohannj commented Jan 24, 2023

Is your feature request related to a problem? Please describe.
I'd like to know if my query contacted ClickHouse or not, which allows me to know if I can trust the statistics which are in the ClickHouse response.

Describe the solution you'd like
Send a new header "X-Cache".
It could have two values: HIT, MISS
Or more values: HIT_LOCAL, HIT_SHARED, MISS

This non standard header is used by CDNs:
https://learn.microsoft.com/en-us/azure/cdn/cdn-msft-http-debug-headers
https://developer.fastly.com/reference/http/http-headers/X-Cache/
https://lyte.id.au/2014/08/28/x-cache-and-x-cache-lookupheaders/
https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-custom-object-caching/

Describe alternatives you've considered
chproxy returns a "Cache-Control: max-age=..." header. It can be used today if one knows the max-age of a query that has just been inserted in the cache, but for example a library has no way to know it, and it can get tricky in case of multiple cache being used with different duration.

Additional context

Blokje5 added a commit to Blokje5/chproxy that referenced this issue Mar 3, 2023
…had a cache miss or hit.

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes ContentSquare#288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Blokje5 added a commit to Blokje5/chproxy that referenced this issue Mar 7, 2023
…had a cache miss or hit.

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes ContentSquare#288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Blokje5 added a commit to Blokje5/chproxy that referenced this issue Mar 10, 2023
…had a cache miss or hit.

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes ContentSquare#288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Blokje5 added a commit to Blokje5/chproxy that referenced this issue Mar 10, 2023
…had a cache miss or hit.

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes ContentSquare#288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Blokje5 added a commit to Blokje5/chproxy that referenced this issue Mar 10, 2023
…had a cache miss or hit.

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes ContentSquare#288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Blokje5 added a commit that referenced this issue Mar 10, 2023
…had a cache miss or hit. (#313)

X-Cache will be set to HIT if a response came from the Cache, otherwise it will be set to MISS.

Fixes #288

Signed-off-by: Lennard Eijsackers <lennardeijsackers92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants