MCPcopy
hub / github.com/long2ice/fastapi-cache / _uncacheable

Function _uncacheable

fastapi_cache/decorator.py:69–84  ·  view source on GitHub ↗

Determine if this request should not be cached Returns true if: - Caching has been disabled globally - This is not a GET request - The request has a Cache-Control header with a value of "no-store"

(request: Optional[Request])

Source from the content-addressed store, hash-verified

67
68
69def _uncacheable(request: Optional[Request]) -> bool:
70 """Determine if this request should not be cached
71
72 Returns true if:
73 - Caching has been disabled globally
74 - This is not a GET request
75 - The request has a Cache-Control header with a value of "no-store"
76
77 """
78 if not FastAPICache.get_enable():
79 return True
80 if request is None:
81 return False
82 if request.method != "GET":
83 return True
84 return request.headers.get("Cache-Control") == "no-store"
85
86
87def cache(

Callers 1

innerFunction · 0.85

Calls 2

get_enableMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected