Skip to content

Commit

Permalink
Support s-maxage pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrekeler committed Oct 29, 2022
1 parent dd53121 commit ffce92d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion httpx_caching/_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,12 @@ def try_from_cache_policy(
# determine freshness
freshness_lifetime = 0

# Check the s-maxage pragma in the cache control header
if "s-maxage" in resp_cc:
freshness_lifetime = resp_cc["s-maxage"]
logger.debug("Freshness lifetime from s-maxage: %i", freshness_lifetime)
# Check the max-age pragma in the cache control header
if "max-age" in resp_cc:
elif "max-age" in resp_cc:
freshness_lifetime = resp_cc["max-age"]
logger.debug("Freshness lifetime from max-age: %i", freshness_lifetime)
# If there isn't a max-age, check for an expires header
Expand Down

0 comments on commit ffce92d

Please sign in to comment.