Home / Function/ get_send_file_max_age() — flask Function Reference

get_send_file_max_age() — flask Function Reference

Architecture documentation for the get_send_file_max_age() function in app.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  b9ae92e8_aac9_2239_118e_1bf35728c3f1["get_send_file_max_age()"]
  9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5["Flask"]
  b9ae92e8_aac9_2239_118e_1bf35728c3f1 -->|defined in| 9f8cc56e_d5c4_e7a8_438a_3124c0dd5de5
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7["send_static_file()"]
  0961f519_f2ef_dd1b_2adf_c3eaabdb53a7 -->|calls| b9ae92e8_aac9_2239_118e_1bf35728c3f1
  style b9ae92e8_aac9_2239_118e_1bf35728c3f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/app.py lines 364–389

    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 = self.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]

Subdomains

Defined In

Called By

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/app.py.
Where is get_send_file_max_age() defined?
get_send_file_max_age() is defined in src/flask/app.py at line 364.
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