caching
This commit is contained in:
parent
33190e3cfe
commit
ba063f7f1b
|
@ -16,7 +16,7 @@ def cache_control(seconds):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
resp = make_response(f(*args, **kwargs))
|
resp = make_response(f(*args, **kwargs))
|
||||||
if seconds >= 0:
|
if seconds > 0:
|
||||||
resp.headers['Cache-Control'] = f'public, max-age={seconds}'
|
resp.headers['Cache-Control'] = f'public, max-age={seconds}'
|
||||||
else:
|
else:
|
||||||
resp.headers['Cache-Control'] = f'no-store'
|
resp.headers['Cache-Control'] = f'no-store'
|
||||||
|
|
|
@ -21,7 +21,6 @@ from ..cache import cache
|
||||||
|
|
||||||
@bp.route('/model', methods=['GET'])
|
@bp.route('/model', methods=['GET'])
|
||||||
@cache.cached(timeout=60, query_string=True)
|
@cache.cached(timeout=60, query_string=True)
|
||||||
@cache_control(60)
|
|
||||||
def get_model():
|
def get_model():
|
||||||
model = get_running_model()
|
model = get_running_model()
|
||||||
if not model:
|
if not model:
|
||||||
|
|
Reference in New Issue