aiohttp-client-cache icon indicating copy to clipboard operation
aiohttp-client-cache copied to clipboard

Feature request: Add only_if_cached similiar to how it exists in requests-cache

Open dodofarm opened this issue 6 months ago • 2 comments

Feature description

It would be great if we would have only_if_cached similar to how it's implemented in the requests-cache library. See here

Use case

I don't want to make an actual request to the server if the content is already cached or even if it's not cached a 504 Not Cached response is more desirable that actually sending a request to the site.

My usecase is rate-limited APIs that have a quota which I don't want waste.

Workarounds

Not that I know of

Plan to implement

I don't have the time to look into this right now sadly.

dodofarm avatar Sep 07 '25 22:09 dodofarm

Looking into this myself today. Seems that revalidation is already partially implemented but doesn't seem to be fully implemented.

I may have time to contribute to aiohttp client cache to add local caching. If there's a todo or something for what else needs to be done to add revalidation support I would love to work on this.

onerandomusername avatar Oct 16 '25 07:10 onerandomusername

Apologies, I misread this issue. This is about getting a cached response from the cache, not about if-none-match.

onerandomusername avatar Oct 16 '25 17:10 onerandomusername