get_send_file_max_age() — flask Function Reference
Architecture documentation for the get_send_file_max_age() function in blueprints.py from the flask codebase.
Entity Profile
Dependency Diagram
graph TD afe24c34_5566_a80f_fbff_bb57cec6d844["get_send_file_max_age()"] 43802377_8224_2289_2f49_1129adf043ee["Blueprint"] afe24c34_5566_a80f_fbff_bb57cec6d844 -->|defined in| 43802377_8224_2289_2f49_1129adf043ee 4a852f3a_2bc8_50e9_493b_6ec8169d1a41["send_static_file()"] 4a852f3a_2bc8_50e9_493b_6ec8169d1a41 -->|calls| afe24c34_5566_a80f_fbff_bb57cec6d844 style afe24c34_5566_a80f_fbff_bb57cec6d844 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/flask/blueprints.py lines 55–80
def get_send_file_max_age(self, filename: str | None) -> int | None:
"""Used by :func:`send_file` to determine the ``max_age`` cache
value for a given file path if it wasn't passed.
By default, this returns :data:`SEND_FILE_MAX_AGE_DEFAULT` from
the configuration of :data:`~flask.current_app`. This defaults
to ``None``, which tells the browser to use conditional requests
instead of a timed cache, which is usually preferable.
Note this is a duplicate of the same method in the Flask
class.
.. versionchanged:: 2.0
The default configuration is ``None`` instead of 12 hours.
.. versionadded:: 0.9
"""
value = current_app.config["SEND_FILE_MAX_AGE_DEFAULT"]
if value is None:
return None
if isinstance(value, timedelta):
return int(value.total_seconds())
return value # type: ignore[no-any-return]
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does get_send_file_max_age() do?
get_send_file_max_age() is a function in the flask codebase, defined in src/flask/blueprints.py.
Where is get_send_file_max_age() defined?
get_send_file_max_age() is defined in src/flask/blueprints.py at line 55.
What calls get_send_file_max_age()?
get_send_file_max_age() is called by 1 function(s): send_static_file.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free