You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/configuration.md
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ github = GitHub(
12
12
user_agent="GitHubKit/Python",
13
13
follow_redirects=True,
14
14
timeout=None,
15
+
cache_strategy=None,
15
16
http_cache=True,
16
17
auto_retry=True,
17
18
rest_api_validate_body=True,
@@ -24,13 +25,15 @@ Or, you can pass the config object directly (not recommended):
24
25
import httpx
25
26
from githubkit import GitHub, Config
26
27
from githubkit.retry importRETRY_DEFAULT
28
+
from githubkit.cache importDEFAULT_CACHE_STRATEGY
27
29
28
30
config = Config(
29
31
base_url="https://api.github.com/",
30
32
accept="application/vnd.github+json",
31
33
user_agent="GitHubKit/Python",
32
34
follow_redirects=True,
33
35
timeout=httpx.Timeout(None),
36
+
cache_strategy=DEFAULT_CACHE_STRATEGY,
34
37
http_cache=True,
35
38
auto_retry=RETRY_DEFAULT,
36
39
rest_api_validate_body=True,
@@ -65,6 +68,10 @@ The `follow_redirects` option is used to enable or disable the HTTP redirect fol
65
68
66
69
The `timeout` option is used to set the request timeout. You can pass a float, `None` or `httpx.Timeout` to this field. By default, the requests will never timeout. See [Timeout](https://www.python-httpx.org/advanced/timeouts/) for more information.
67
70
71
+
### `cache_strategy`
72
+
73
+
The `cache_strategy` option defines how to cache the tokens or http responses. You can provide a githubkit built-in cache strategy or a custom one that implements the `BaseCacheStrategy` interface. By default, githubkit uses the `MemCacheStrategy` to cache the data in memory.
74
+
68
75
### `http_cache`
69
76
70
77
The `http_cache` option enables the http caching feature powered by [Hishel](https://hishel.com/) for HTTPX. GitHub API limits the number of requests that you can make within a specific amount of time. This feature is useful to reduce the number of requests to GitHub API and avoid hitting the rate limit.
0 commit comments