-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Conditional Requests / HTTP Caching #175
Comments
Thank you for your issue! While I would definitely like to have this feature in octocrab, I'm hesitant to add any reqwest middleware as I want to remove reqwest as a dependency in this library (see #168), and adding middleware would make this harder. Also I would not want to just have filesystem based caching, ideally it would be a pluggable solution (such as a trait) that allows people to provide their own caching implementation, because a lot of people aren't having long running processes and don't want to fill the filesystem with cache requests when we're also not providing cleanup. So to summarise, I'm in favour of having it, but want to move to Sans-IO first (or use an agnostic approach), and I want a cache storage trait that handles the actual caching problem. |
Has there been any progress on this issue? If not, I'd be interested in contributing. I don't want to duplicate existing work though. |
Looks like this is ready to be implemented. However, before that happens, what is the best way to go about providing caching at the application level (without changing this library yet, that is)? |
The GitHub API supports conditional requests per HTTP RFC 7234. From the GitHub API docs (emphasis my own):
For those that have ambitious goals for their GitHub-integrated projects, this is very valuable, as the 5,000-requests-per-hour rate limit may become very limiting without caching.
Another crate,
octorust
, provides support for HTTP caching as an optional feature. I was planning to useoctorust
for a project for this reason, but I discovered Octocrab and I would prefer to use the higher-level constructs provided by it.I think the path to supporting this may not be too hard. There is a
reqwest-middleware-cache
crate that appears to provide a very easy shim layer around areqwest::Client
.Here's what I imagine the usage would look like:
Cargo.toml:
main.rs:
The text was updated successfully, but these errors were encountered: