-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
chore(feat): Integrate HTTP Caching Model for authx ✨ #217
Conversation
Codecov Report
@@ Coverage Diff @@
## main #217 +/- ##
==========================================
+ Coverage 93.83% 94.07% +0.24%
==========================================
Files 41 46 +5
Lines 1444 1706 +262
==========================================
+ Hits 1355 1605 +250
- Misses 89 101 +12
Continue to review full report at Codecov.
|
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.13%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
HTTPCache
Overview
HTTP caching occurs when the browser stores local copies of web resources for faster retrieval the next time the resource is required. As your application serves resources it can attach cache headers to the response specifying the desired cache behavior.
When an item is fully cached, the browser may choose to not contact the server at all and simply use its cached copy:
HTTP cache headers
There are two primary cache headers,
Cache-Control
andExpires
.Cache-Control
The
Cache-Control
header is the most important header to set as it effectivelyswitches on
caching in the browser. With this header in place, and set with a value that enables caching, the browser will cache the file for as long as specified. Without this header, the browser will re-request the file on each subsequent request.Expires
When accompanying the
Cache-Control
header, Expires simply sets a date from which the cached resource should no longer be considered valid. From this date forward the browser will request a fresh copy of the resource.AuthX provides a simple HTTP caching model designed to work with FastAPI,
Initialize the cache