yanyongyu / githubkit

The modern, all-batteries-included GitHub SDK for Python, including rest api, graphql, webhooks, like octokit!
MIT License
159 stars 21 forks source link

Use HTTP caching #61

Closed karpetrosyan closed 7 months ago

karpetrosyan commented 7 months ago

Hi! First, thanks for this amazing package.

I'm wondering if you can use Hishel to reduce network traffic and possibly save some rate limits. Users will be able to save time on responses that support caching (almost every github response).

You could enable in-memory caching at the library level and provide an API to the hishel so users can configure caching and possibly store responses in persistent storage so they can reuse cached responses across multiple executions.

There is also a useful example in the documentation that shows how effective caching can be when working with the github APIs.

If you decide to add this feature, I will gladly submit a pull request!

yanyongyu commented 7 months ago

This feature seems to be very useful. githubkit previously only considered caching tokens (but still has some problems #44) and ignored api requests. Maybe we could cache both request results and tokens and provide an cache option when creating the GitHub instance.

karpetrosyan commented 7 months ago

As far as I can tell, we can use both caches and they should not conflict.

Is GitHub the only entry point that should support caching, or are there others?

yanyongyu commented 7 months ago

The token cache is used in the auth strategy, and the strategy can read configs from the github instance. so, github could be the only entry point and auth strategy could also get the storage provider from it.