INNER CODE UNIT · Python
age
redis/fastapi-redis-sdk · src/redis_fastapi/cache.py:162
age = ttl - remaining_ttl
return age >= max_age
def _cache_control_value(max_age: int, private: bool) -> str:
"""Build a ``Cache-Control`` response header value.
When *max_age* is ``0`` (no TTL), no ``max-age`` directive is emitted;
the header contains only ``no-cache`` (always revalidate via ETag).
Args:
max_age: The ``max-age`` value in seconds. ``0`` means no expiry.
private: Whether to include the ``private`` directive.
Returns:
The formatted header value string.
"""
if max_age <= 0: