INNER CODE UNIT · Python
MAX_CACHEABLE_HEADER_SIZE
redis/fastapi-redis-sdk · src/redis_fastapi/cache.py:274
MAX_CACHEABLE_HEADER_SIZE: int = 8 * 1024
# RFC 9110 section 15.4.5: a 304 carries validators and cache metadata, not
# the representation metadata a 200 would. Replaying the whole stored block
# on a 304 would send a Content-Type for a response that has no content.
NOT_MODIFIED_HEADERS: frozenset[bytes] = frozenset(
{b"etag", b"cache-control", b"vary", b"content-location", b"expires"}
)
# ``(route, reason)`` pairs already logged, so a refused route warns once
# rather than on every request.
_WARNED_REFUSALS: set[tuple[str, str]] = set()
def _find_header(headers: list[tuple[bytes, bytes]], name: bytes) -> bytes | None:
"""Return the first value for raw ASGI header *name* (lowercase), if present.
Args: