This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/util/cache.py
2014-01-02 18:01:34 -05:00

21 lines
483 B
Python

from functools import wraps
def cache_control(max_age=55):
def wrap(f):
@wraps(f)
def add_max_age(*args, **kwargs):
response = f(*args, **kwargs)
response.headers['Cache-Control'] = 'max-age=%d' % max_age
return response
return add_max_age
return wrap
def no_cache(f):
@wraps(f)
def add_no_cache(*args, **kwargs):
response = f(*args, **kwargs)
response.headers['Cache-Control'] = 'no-cache'
return response
return add_no_cache