INNER CODE UNIT · Python

_is_cacheable_media_type

redis/fastapi-redis-sdk · src/redis_fastapi/cache.py:330

def _is_cacheable_media_type(media_type: str) -> bool:
    """Whether *media_type* names a representation this cache can replay.

    Args:
        media_type: Lowercased media type, without parameters.

    Returns:
        ``True`` for text and the JSON/XML families, ``False`` otherwise.
    """
    if media_type in CACHEABLE_MEDIA_TYPES:
        return True
    if media_type.startswith("text/"):
        return True
    return media_type.startswith("application/") and media_type.endswith(
        CACHEABLE_MEDIA_SUFFIXES
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…