Skip to content

Support for caching #680

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

Closed
ekrekeler opened this issue Oct 2, 2022 · 2 comments
Closed

Support for caching #680

ekrekeler opened this issue Oct 2, 2022 · 2 comments
Labels
👎 wont do This will not be worked on

Comments

@ekrekeler
Copy link

Documentation is sparse and I do not see a way to enable caching for clients generated with openapi-python-client.

Many APIs that leverage OpenAPI will also support content caching and send headers for TTL. When using the same openapi-python-client object to make the same calls, I notice it is making a new request and not serving from a cache. Does this client have support for caching at all? What would be the best way to enable caching with the Cache-Control and Expires headers from the responses?

@dbanty
Copy link
Collaborator

dbanty commented Oct 2, 2022

There are no caching features in generated clients. I don't believe there are any caching features built into the OpenAPI spec either, so adding them is probably out of scope for this project.

Maybe it could be added as a client middleware once #202 happens. Until then, something would have to be done with custom templates I think.

@dbanty dbanty added the 👎 wont do This will not be worked on label Oct 2, 2022
@dbanty dbanty closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2022
@ekrekeler
Copy link
Author

Thanks for the answers. I am not certain how to use the templates, but since I am using the client in a Flask app I will just cache the objects in a database and use the response headers to define expiration. I do think caching would be a useful feature to have built-in however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👎 wont do This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants