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])
| 67 | |
| 68 | |
| 69 | def _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 | |
| 87 | def cache( |
no test coverage detected