fastapi-cache
fastapi-cache copied to clipboard
X-FastAPI-Cache header not available in fastapi-cache2 v0.2.1
X-FastAPI-Cache header is not available in fastapi-cache2 v0.2.1 The latest release v0.2.1 was from February while the source code has been modified in main branch since. https://pypi.org/project/fastapi-cache2/#history https://github.com/long2ice/fastapi-cache/commit/915f3dd8f2dfe6699a7d6202d8b9c687dd9b15df
Hi: It looks like this is still the case, that Pypi doesn't have the May 17 version, which includes updates here. Is there a way to schedule a deployment please? Thanks much!
Is still an issue as of Jan 2024. I hope @long2ice can help with this
I think that the new version of fastapi-cache has some Pydantic compatibility issues that were beyond my understanding, so we can't simply build and deploy. That may be why @long2ice has delayed publishing. If anyone can help fix https://github.com/long2ice/fastapi-cache/issues/249 then we should be able to update.
Message ID: @.***>
@mrisher thanks for the response. In the meantime, can you point me to any other way to know, if a request was a cache hit or miss? I need it in my logging middleware, so that I don't log cached responses multiple times as it produces high load. Thanks
In my experiments, I get something like:
x-cache: MISS
x-cache-hits: 0
Try
'https://<your server>' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <token>'
On Tue, Jan 16, 2024 at 11:44 AM Arsenii Velichko @.***> wrote:
@mrisher https://github.com/mrisher thanks for the response. In the meantime, can you point me to any other way to know, if a request was a cache hit or miss? I need it in my logging middleware, so that I don't log cached responses multiple times as it produces high load. Thanks
— Reply to this email directly, view it on GitHub https://github.com/long2ice/fastapi-cache/issues/281#issuecomment-1893490990, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVHNS5ORLT664XU56YCKTYOZKXFAVCNFSM6AAAAAA3Z3BYV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGQ4TAOJZGA . You are receiving this because you were mentioned.Message ID: @.***>
@mrisher I'm not sure, how you get these headers to appear in the response. For me, these are the only headers that I get in my responses:
cache-control: max-age=30
content-length: 784
content-type: application/json
date: Tue,16 Jan 2024 10:58:22 GMT
etag: W/-6181376353854741601
server: uvicorn
I don't know :( My solution to the error I was getting is, I made a fork (I think from this commit https://github.com/long2ice/fastapi-cache/pull/328) and then am installing it locally using a PIP Requirements.txt pinned to my local repo. So maybe that fork uses a slightly newer version than what was in Pypi? I can't remember how to confirm the branch commit... do you know how?
On Tue, Jan 16, 2024 at 12:00 PM Arsenii Velichko @.***> wrote:
@mrisher https://github.com/mrisher I'm not sure, how you get these headers to appear in the response. For me, these are the only headers that I get in my responses:
cache-control: max-age=30 content-length: 784 content-type: application/json date: Tue,16 Jan 2024 10:58:22 GMT etag: W/-6181376353854741601 server: uvicorn
— Reply to this email directly, view it on GitHub https://github.com/long2ice/fastapi-cache/issues/281#issuecomment-1893517191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVHNVXGGHTUZJOF2NP4BLYOZMVRAVCNFSM6AAAAAA3Z3BYV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGUYTOMJZGE . You are receiving this because you were mentioned.Message ID: @.***>
Ran also into this, will try to work out a fix.