def set_cache_protected_period(connection: 'Connection', protected_period: int
    ) ->None:
    """
    Set the cache's half-life.

    Parameters
    ----------
    connection : "Connection"
    protected_period : int, default None
        Optionally specify a number of seconds within which cache entries are excluded.
    """
    sql = (
        f"UPDATE cache.cache_config SET value='{int(protected_period)}' WHERE key='protected_period'"
        )
    with connection.engine.begin() as trans:
        trans.execute(sql)
